-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Parser: YAML anchors & aliases depend on declaration order #609
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
Comments
Yes, in YAML you should define an alias before using it. If you put definitions after paths the swagger: '2.0'
info:
version: "0.0.1"
title: API
x-types:
OperationType: &OperationType
- registration
# Describe your paths here
paths:
/checker:
get:
parameters:
- name: operations
in: query
type: array
items:
type: string
enum: *OperationType
default: [registration]
responses:
200:
description: OK
schema:
$ref: '#/definitions/OperationType'
definitions:
OperationType:
type: string
enum: *OperationType
|
Ah, thanks! I wasn't aware this was a YAML limitation (even though the examples I've found all declared the anchors first). Will follow your example and declare some lists up top. |
Hi
This following example works:
But if the order of
paths:
anddefinitions:
is reversed, it results in the following error:This is probably an error in the YAML Parsing dependency, but I'm not sure.
Thanks!
The text was updated successfully, but these errors were encountered: