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

[BUG][GO][Client] Generated GO Client Looses Millisecond Resolution With Time URL Query Params #18672

Closed
gonzogomez opened this issue May 14, 2024 · 0 comments

Comments

@gonzogomez
Copy link
Contributor

gonzogomez commented May 14, 2024

Description

Generated Go Client code will use t.Format(time.RFC3339) in the function parameterAddToHeaderOrQuery. This call will cause the time object to loose millisecond resolution when adding the query param to the request.

Time object that has the following timestamp 2024-05-14 02:43:39.7551 will be converted to 2024-05-14T02:43:39Z instead of 2024-05-14T02:43:39.7551Z

openapi-generator version

7.5.0

OpenAPI declaration file content or url

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml

Command line used for generation

./run-in-docker.sh generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g go -o /gen/out/go-petstore -p packageName=petstore

Steps to reproduce

Generate the go code with petstore.yaml
./run-in-docker.sh generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g go -o /gen/out/go-petstore -p packageName=petstore

Suggest a fix

In file modules/openapi-generator/src/main/resources/go/client.mustache function parameterAddToHeaderOrQuery.

parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), collectionType)

Using t.Format(time.RFC3339Nano) instead of t.Format(time.RFC3339) will keep the millisecond resolution.

Pull Request: #18673

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant