-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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(genswagger:template):added support for google.protobuf.Timestamp #209
improve(genswagger:template):added support for google.protobuf.Timestamp #209
Conversation
github is failing to check if Eran has signed a CLA. @EranAvidor please sign the CLA if you have not yet |
@EranAvidor shows up as not signed CLA yet. |
Eran, Thanks for your contribution to the project! Is there any chance I could get you to update one of the example .proto files to include the usage examples for swagger in Thanks again |
sorry for the delay @achew22 , enjoy your weekend. |
@wing328, To my novice eyes this looks like it generates a swagger template that will do time. However, the documentation on getting times working is a little sparse so this is based on my generating code. Would you be willing to take a look at the generated swagger output and say if this is the correct approach? |
@wing328 The lines in question are here. By my of the spec, specifically this section:
It looks like you can do one of two things. i. put the format as the literal token "date-time" Which way is the correct way to interpret that? Now that I'm reading it more closely I suspect that it might be the prior. |
@achew22 if the datetime string conforms to RFC3339, then you can specify the format as This is the first time I saw people documenting a datetime string in the following format:
and the Tools like swagger codegen only recognize |
if fd.GetTypeName() == ".google.protobuf.Timestamp" && pbdescriptor.FieldDescriptorProto_TYPE_MESSAGE == ft { | ||
core = schemaCore{ | ||
Type: "string", | ||
Format: "0000-00-00T00:00:00.000000000Z", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @wing328 for taking a look.
@EranAvidor Do you think you could update this to say "date-time" instead of "0000-00-00T00:00:00.0000000Z"?
Hi @achew22 , I just replaced the format as we talked. |
rebased with master |
This looks good to me. I generated clients in a couple of languages and the generated code has these new fields typed as Date objects. Can you regenerate the examples to make the tests pass and then upload again? Thank you! |
@achew22 done. |
Looks good to me. Merged |
…supported-types improve(genswagger:template):added support for google.protobuf.Timestamp
google.protobuf.Timestamp is constructed from 2 primitives (int32, 64) which results in a wrong swagger file.