Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve WKT handling in gateway and openapi output #404

Merged
merged 1 commit into from
Dec 5, 2017

Conversation

tmc
Copy link
Collaborator

@tmc tmc commented May 30, 2017

This improves Timestamp and Duration support in field marshaling and openapi/swagger output.

@tmc
Copy link
Collaborator Author

tmc commented May 30, 2017

refs #400

@@ -56,3 +60,17 @@ func Uint32(val string) (uint32, error) {
}
return uint32(i), nil
}

// Timestamp converts the given RFC3339 formatted string into a timestamp.Timestamp.
func Timestamp(val string) (*timestamp.Timestamp, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would these functions be called?

Copy link
Collaborator Author

@tmc tmc May 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are dropped in as 'runtime.Timestamp' calls via ConvertFuncExpr

}

// Duration converts the given string into a timestamp.Duration.
func Duration(val string) (*duration.Duration, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a couple of simple tests to validate this?

Copy link
Collaborator Author

@tmc tmc May 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was considering that but figured this code was well-tested in jsonpb

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been thinking on this for a bit. I think you're just exposing helper methods against jsonpb. That should mean they are well tested. If these were to become more complex then I would want tests but they are just so imple I think we should leave it.

@AlekSi
Copy link
Contributor

AlekSi commented Aug 10, 2017

Any update on this?

@tmc
Copy link
Collaborator Author

tmc commented Aug 10, 2017

@AlekSi this is waiting on some additional test coverage. I've been bogged down with ${dayjob} and haven't written said tests. This could land sooner if those were contributed.

@achew22
Copy link
Collaborator

achew22 commented Aug 10, 2017

@AlekSi, if this is a thing that you need soon, I bet @tmc would be happy to have you clone this branch and write the tests so we can merge it.

@ajalab
Copy link

ajalab commented Dec 4, 2017

I'm facing the similar problem about WKT handling now, so I would like to take over this task.
Where should I write tests for Duration?

@tmc
Copy link
Collaborator Author

tmc commented Dec 4, 2017

I think adding a convert_test.go file would be appropriate.

}

// Duration converts the given string into a timestamp.Duration.
func Duration(val string) (*duration.Duration, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been thinking on this for a bit. I think you're just exposing helper methods against jsonpb. That should mean they are well tested. If these were to become more complex then I would want tests but they are just so imple I think we should leave it.

@achew22
Copy link
Collaborator

achew22 commented Dec 5, 2017

@ajalab I think I was wrong to request testing on those methods and block. I'm going to merge this. If you have any more needs beyond this can you send another PR?

@achew22 achew22 merged commit 04d5a1e into grpc-ecosystem:master Dec 5, 2017
@tmc tmc deleted the wkt-improvements branch December 5, 2017 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants