I have an object in my definitions section that needs to have a property named security, but when i do this the swagger editor gives me the error message:
Semantic error at definitions.User.properties.security.properties security requirements must match a security definition Jump to line 49
Here's my definition
definitions:
Security:
type: object
properties:
name:
type: string
User:
type: object
required:
- can
- username
properties:
can:
type: integer
readOnly: true
username:
type: string
format: email
readOnly: true
security:
$ref: '#/definitions/Security'
Is there anything I can do this and avoid the error?
This bug was fixed in Swagger Editor 3.2.0+ back in 2017.
The issue was that model properties named security
were incorrectly flagged as part of security definitions. Actually security
should be treated as a reserved keyword only when used on the global level or path level; it's OK to have a model property named security
.