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

Format for date-time missing across API spec #2

Open
someone1 opened this issue Apr 7, 2021 · 1 comment
Open

Format for date-time missing across API spec #2

someone1 opened this issue Apr 7, 2021 · 1 comment

Comments

@someone1
Copy link

someone1 commented Apr 7, 2021

The OpenAPI 2.0 specification allows for data types such as date-time to enhance the basic types. Adding this data will make generated clients much more useful, for example:

  ClientCredentialToken:
    type: "object"
    title: "ClientCredentialToken"
    properties:
      expiresIn:
        format: "int32"
        description: "Time in seconds after which the issued accessToken expires.<br><br><b>Endpoints</b>:<ul><li>POST /auth/token</li></ul>"
        readOnly: true
        type: "integer"
      issuedAt:
        description: "The date and time on which accessToken was created for the customer.<br><br><b>Endpoints</b>:<ul><li>POST /auth/token</li></ul>"
        readOnly: true
        type: "string"
        format: date-time
      accessToken:
        description: "Access Token to access YSL 1.1 services.<br><br><b>Endpoints</b>:<ul><li>POST /auth/token</li></ul>"
        readOnly: true
        type: "string"

I can see that format is being used for other types, in this example, the int32 format for the integer type.

References:

@someone1
Copy link
Author

The same can be done for format: date for non-time specific dates (e.g. from and to params).

And although not an official part of the spec, some generators support a decimal type found in most languages, may be useful for the money type, or a more comprehensive money type (like this one for protobuf)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant