Openapi-specification: Support for Constant Value in API

Created on 29 Jun 2018  路  4Comments  路  Source: OAI/OpenAPI-Specification

Since OpenAPI can be used to generate client code, it is good to support some constant value in the API itself.

Use case: When you add type info to a class as a properties, we need that property for deserialization and the value of this property will never change.

Most helpful comment

Can you not do this with an enum property which only has one value?

MySchema:
  type: object
  properties:
    MyProperty:
      type: string
      enum:
      - constantValue

All 4 comments

Can you not do this with an enum property which only has one value?

MySchema:
  type: object
  properties:
    MyProperty:
      type: string
      enum:
      - constantValue

Possibly related: #1313

Can you not do this with an enum property which only has one value?

Yes thats how it needs to be done now, but it's a bit verbose and it doesn't look nice in your documentation (generated web pages), where it will show as an expandable list of one item VS just the string value.

Closing, as this is a dupe of #1313 as @hkosova observed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nomadtechie picture nomadtechie  路  4Comments

slinkydeveloper picture slinkydeveloper  路  4Comments

mission-liao picture mission-liao  路  3Comments

satkunas picture satkunas  路  4Comments

rossi-jeff picture rossi-jeff  路  5Comments