OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
It seems like readOnly fields get dropped from the Swagger UI after generating the server stub.
The spec downlaoded from the server at /api/v3/openapi.json still holds the readOnly field, and it shows correctly in the public https://editor.swagger.io/ , but the Swagger UI hosted by the generated server doesn't respect it.
Visit http://localhost:8080/api/v3/ui/#/pet/add_pet. Switch to application/x-www-form-urlencoded. The id field is no longer readOnly- it appears in the Request Body Parameters.
Download the /api/v3/openapi.json file from the UI, it still has the readOnly field, and it displays OK if pasted into https://editor.swagger.io/
Description
It seems like readOnly fields get dropped from the Swagger UI after generating the server stub.
The spec downlaoded from the server at
/api/v3/openapi.json
still holds the readOnly field, and it shows correctly in the public https://editor.swagger.io/ , but the Swagger UI hosted by the generated server doesn't respect it.openapi-generator version
4.3.1
OpenAPI declaration file content or url
Start with https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml and set the following property:
Steps to reproduce & generate
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v4.3.1 generate --input-spec /local/petstore.yaml --generator-name python-flask --output /local
docker build -t openapi_server .
,docker run -p 8080:8080 openapi_server
http://localhost:8080/api/v3/ui/#/pet/add_pet
. Switch toapplication/x-www-form-urlencoded
. The id field is no longer readOnly- it appears in the Request Body Parameters./api/v3/openapi.json
file from the UI, it still has the readOnly field, and it displays OK if pasted into https://editor.swagger.io/