I try to generate a REST API definition with Swagger and YAML,
but at $ref: '#/definitions/Token'
I get the error
Bad indentation of a mapping entry
parameters:
- name: environmentID
in: query
description: id from the gamificationenvironment
required: true
type: integer
format: int32
- name: authorizationToken
in: query
description: Authorization token to create a new environment
required: true
schema:
type: object
--> Error $ref: '#/definitions/Token'
responses:
201:
description: GamificationID for the Admin
schema:
type: object
items:
$ref: '#/definitions/Environment'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
definitions:
Token:
required:
- authentificationKey
- user
properties:
authentificationKey:
type: string
senderID:
type: integer
format: int32
user:
type: string
type: integer
format: int64
Error:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
fields:
type: string
My Question is:
Why does the Mapping with $ref
is working at the responses and
at the paramets I get an error ?
This part is syntactically incorrect:
required: true
schema:
type: object
$ref: '#/definitions/Token'
schema:
should be at same level as required:
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With