Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQ] support for "const" keyword #10445

Open
jorgerod opened this issue Sep 21, 2021 · 3 comments
Open

[REQ] support for "const" keyword #10445

jorgerod opened this issue Sep 21, 2021 · 3 comments

Comments

@jorgerod
Copy link
Contributor

jorgerod commented Sep 21, 2021

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

#1916

@jorgerod
Copy link
Contributor Author

Hi @jmini @wing328
How do you see it? I could even contribute it myself

@jbezuk
Copy link

jbezuk commented Oct 8, 2021

Hello, maybe this is an okay place to bring up the question of general OAS 3.1 support? Another feature of 3.1 that brought me to this post was making the paths property optional, so that you can use a file to describe only, for example, reusable components. Currently the workaround is to use version 3 and turn off spec validation.
https://github.com/OAI/OpenAPI-Specification/releases/tag/3.1.0-rc0

@jorgerod
Copy link
Contributor Author

jorgerod commented Oct 8, 2021

Hi @jmini @wing328
How do you see it? I could even contribute it myself

@jorgerod jorgerod changed the title [REQ] support for const keyword [REQ] support for "const" keyword Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants