[scala][http4s] fix codegen for using reserved words in openapi #21490
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is an example of correct openAPI specification:
{ "openapi": "3.0.0", "info": { "title": "Simple API", "description": "A simple API with GET and POST endpoints", "version": "1.0.0" }, "servers": [ { "url": "https://api.example.com/v1" } ], "paths": { "/users": { "get": { "summary": "Method with non-escaped parameter and escaped parameter", "parameters": [ { "name": "id", "in": "query", "description": "Non-escaped parameter that should not be modified", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "type", "in": "query", "description": "Escaped parameter that should be modified", "required": true, "schema": { "type": "string", "enum": [ "active", "inactive", "pending" ] } } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } } } } }, "/users/{type}/{var}/{id}": { "get": { "summary": "Method with non-escaped parameter, escaped string parameter and escaped long parameter", "parameters": [ { "name": "type", "in": "path", "required": true, "description": "Escaped string parameter that should be modified", "schema": { "type": "string", "enum": [ "active", "inactive", "pending" ] } }, { "name": "var", "in": "path", "required": true, "description": "Escaped long parameter that should be modified", "schema": { "type": "integer", "format": "int64" } }, { "name": "id", "in": "path", "required": true, "description": "Non-escaped parameter that should not be modified", "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } } } } } }, "components": { "schemas": { "User": { "type": "object", "properties": { "result": { "type": "string", "enum": [ "active", "inactive", "pending" ] } }, "required": [ "result" ] } } } }For given OpenAPI specification generated not compiled code because it uses reserved words.
I changed
baseNametoparamNameto use escaped variables instead of reserved words forscala-http4s-serverPR checklist
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)Hello! 👋
I'd love to get your eyes on this PR when you have a moment.
Thanks in advance!
@clasnake (2017/07), @shijinkui (2018/01), @ramzimaalej (2018/03), @chameleon82 (2020/03), @Bouillie (2020/04) @Fish86 (2023/06)