v1.2 Semantic Validation #1

Closed
whitlockjc opened this Issue Jun 17, 2014 · 3 comments

Projects

None yet

2 participants

@whitlockjc
Member

We need to do more than just structural validation of the Swagger files:

***** The validation requires both the resource listing file and the API declaration/resource files

Errors

  • Ensure model ids are unique
  • Ensure model references point to defined models
  • Ensure model subTypes are not cyclical
  • Ensure model subTypes do not override inherited properties
  • Ensure model subTypes do not reference multiple "parent" objects (multiple inheritance)
  • Ensure model required properties actually exist on the model object
  • Ensure model discriminator property exists
  • Ensure API operation nicknames are unique (within a single apiDeclaration/resource)
  • Ensure API operation authorization references point to defined authorization *****
  • Ensure API operation authorization scopes (oauth 2 only) point to a defined scope *****
  • Ensure API operation method is unique
  • Ensure API operation responseMessages respond with unique response code
  • Ensure resource listing paths point to defined apiDeclaration/resource *****
  • Ensure the defaultValue of a parameter is within its type constraints

Warnings

  • Declared but unreferenced authorization *****
  • Declared but unreferenced authorization scope *****
  • Declared but unreferenced model
  • Duplicate entries for model subTypes
  • Mismatched Swagger version across an API *****
  • API operation summary is greater than 120 characters
@webron
webron commented Jun 18, 2014

Regarding the defaultValue, the same would apply to minimum and/or maximum.
Another thing you can check regarding the defaultValue is that its type corresponds with the type+format fields. Not sure if the JSON Schema currently checks this, not sure if it can.

@whitlockjc
Member

Thanks Ron, that helped a lot. I went back and updated the issue to reflect.

@whitlockjc
Member

Based on what is known right now, this issue is complete. Please file bugs/enhancements related to semantic validation as new issues.

@whitlockjc whitlockjc closed this Jul 11, 2014
This was referenced Jul 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment