4

I wrote a parameter that "type:" is "string" and "example:" is a text datetime without time zone like "2021-09-01 00:00:00".

but on the UI that was generated by swagger-codegen-cli-3.0.27.jar or openapi-generator-cli-5.2.1.jar, the parameter format is ISO 8601 format with UTC timzone like "2021-09-01T00:00:00Z"

I don't want to convert datetime format. I want to show without time zone style. How do I write spec file?

test.yml

openapi: 3.0.3
info:
  title: test
  version: 1.0.0
paths:
  /test/{dateTime}/:
    get:
      parameters:
        - name: "dateTime"
          in: "path"
          required: true
          schema:
            type: string
            example: "2021-09-01 00:00:00"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  dateTime2:
                    type: string
                    example: "2021-09-01 00:00:00"

then

java -jar swagger-codegen-cli-3.0.27.jar generate -i test.yaml -l python-flask -o test-flask
cd test-flask
python -m swagger_server

or

java -jar openapi-generator-cli-5.2.1.jar generate -i test.yaml -g python-flask -o test-flask
cd test-flask
python -m openapi_server

then open "http://localhost:8080/ui/#/default/test_date_time_get"

enter image description here

Alumuko
  • 171
  • 2
  • 11

0 Answers0