Swagger-editor: Semantic validation is not triggered for some schemas

Created on 23 Jan 2020  路  2Comments  路  Source: swagger-api/swagger-editor

Some schemas do not trigger semantic validation.

Looks like the schema selectors (allSchemas, isSubSchema, etc.) don't pick up everything.
https://github.com/swagger-api/swagger-editor/blob/master/src/plugins/validate-semantic/selectors.js

Q&A (please complete the following information)

  • OS: Windows 10
  • Browser: Chrome latest
  • Method of installation: https://editor.swagger.io
  • Swagger-Editor version: 3.8.0
  • Swagger/OpenAPI version: 2.0, 3.0

Content & configuration

OAS2:

swagger: '2.0'
info:
  title: Enum value validation against schema
  version: 1.0.0
paths: {}
definitions:
  Foo:
    allOf:
      - type: string
        enum: [1]   # should trigger warning

OAS3:

openapi: 3.0.0
info:
  title: Enum value validation against schema
  version: 1.0.0
paths: {}

components:
  requestBodies:
    fooBody:
      content:
        application/json:
          schema:
            type: string
            enum: [1]   # should trigger warning

  headers:
    fooHeader:
      schema:
        type: string
        enum: [1]    # should trigger warning

  schemas:
    Foo:
      type: string
      enum: [1]      # should trigger warning
    Foo2:
      allOf:  # also oneOf, anyOf
        - type: string
          enum: [1]  # should trigger warning
validation bug

All 2 comments

@ralphdoe GitHub isn't letting me assign this to you, but this one's yours!

@shockey fixed! the assignment)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fchebbo picture fchebbo  路  5Comments

alecmev picture alecmev  路  4Comments

bluesh55 picture bluesh55  路  3Comments

rrberry picture rrberry  路  4Comments

marcopiraccini picture marcopiraccini  路  3Comments