Swagger Definition of primitive types

Viewed 1814

Is it possible to define a swagger definition/model for a primitive type? For instance, consider the following

definitions:
  program_name:
    type: string
    description: Unique string id

However, the above example comes back with many errors (swagger expects a properties field for example) and no examples employ any definition that is not of type: object.

The intention is to use this as a subcomponent to another model as well as a parameter -- to reuse the already defined component in some way.

Think of this as a swagger typedef

EDIT: According to the spec, a definition object is the same as a schema object http://swagger.io/specification/#schemaObject, which states that it can accept primitive types.

Also, assuming that primitive types can exist in the definitions section, could simple parameter types (query, path etc.) reference primitive definition types?

1 Answers
Related