Open grokify opened 5 years ago
I just verified this using the following cURL command which simulates the request made by store_api_test.go
when executed by mvn verify -f samples/client/petstore/go
:
$ curl -XPOST 'http://petstore.swagger.io:80/v2/store/order' -H 'Content-Type: application/json' -d '{"shipDate":"2018-11-01T00:00:00Z","status":"placed"}'
The petstore.swagger.io
server returns the following body which includes a ISO 8601 date-time with a +0000
offset, not a RFC 3339 date-time.
{"id":0,"petId":0,"quantity":0,"shipDate":"2018-11-01T00:00:00.000+0000","status":"placed","complete":false}
The build uses swaggerapi/petstore
which is not ours. We should use openapitools/openapi-petstore
instead on which I'm pretty sure this issue doesn't exist.
The commands to spawn our docker petstore are there but commented. @wing328 do you know why ?
Description
The following error is encountered when running tests for the client:
https://circleci.com/gh/grokify/openapi-generator/91#tests/containers/1
Of note, the
date-time
value that parsing is being attempted for has an offset that is invalid in RFC 3339 format, namely, the UTC offset is+0000
and does not have a colon (:
) which is required by RFC 3339.The Petstore OpenAPI 2.0 spec shows that the OpenAPI type
date-time
is used:https://github.com/OpenAPITools/openapi-generator/blob/8507916d569a8614286708d45a3cbae20e4da6f2/modules/openapi-generator/src/test/resources/2_0/petstore.yaml#L566-L582
Both OpenAPI 2.0 and 3.0 require RFC 3339 format
date-time
:RFC 3339 requires a colon:
https://tools.ietf.org/html/rfc3339#section-5.6
Of note, a
+0000
offset without a colon is a valid ISO 8601 date-time offset / timezone designator, but ISO 8601 is not used by OpenAPI spec. Here are the formats for ISO 8601.https://en.wikipedia.org/wiki/ISO_8601
openapi-generator version
master: 8507916d569a8614286708d45a3cbae20e4da6f2
OpenAPI declaration file content or url
https://github.com/OpenAPITools/openapi-generator/blob/8507916d569a8614286708d45a3cbae20e4da6f2/modules/openapi-generator/src/test/resources/2_0/petstore.yaml
Command line used for generation
Steps to reproduce
Run Go tests locally or on CI:
Related issues/PRs
Encountered here:
https://github.com/OpenAPITools/openapi-generator/pull/1291
Suggest a fix/enhancement
This appears to be a server issue. If so, have the server return a RFC 3339 compliant
date-time
format value like either of the following:2018-10-29T21:02:19.201+00:00
2018-10-29T21:02:19.201Z