OpenAPITools / OpenAPITools/openapi-generator
[REQ] support for "const" keyword
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
OpenAPI's Schema Object for OAS 3.1 to use JSON Schema 2019-09, which includes the const keyword (In this PR: Defining constant value in response the introduction of this keyword was discussed)
Describe the solution you'd like
The OpenAPI Spec would looks like:
components:
schemas:
UserBody:
type: object
properties:
kind:
type: string
const: MyConstant
id:
type: integer
firstName:
type: string
lastName:
type: string
Generated source:
public class UserBody {
public final Static String KIND = "MyConstant"
//...
}
Describe alternatives you've considered
IMHO, define an enum attribute with a single value in the list is not the same.
Related issues
https://github.com/OpenAPITools/openapi-generator/issues/1916
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the OAS 3.1 Schema Object and the const keyword specification linked in the issue, then review the related OpenAPI discussion and issue 1916. Confirm how the const value should appear in the generated Java UserBody model and define completion across the affected generators and their tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100