RepreZen / KaiZen-OpenAPI-Editor

Eclipse Editor for the Swagger-OpenAPI Description Language
Eclipse Public License 1.0
115 stars 12 forks source link

not and $ref is not supported #450

Open jmini opened 6 years ago

jmini commented 6 years ago

Take this OAS3 spec:

openapi: 3.0.1
info:
  title: not test
  version: '1.0'
servers:
  - url: 'http://localhost:8000/'
paths:
  /some/ping:
    get:
      operationId: pingOp
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/SomeObj'
components:
  schemas:
    SomeObj:
      type: object
      properties:
        other:
          not:
            $ref: '#/components/schemas/OtherObj'
    OtherObj:
      type: string
      enum: [A, B, C]
KaiZen-OpenAPI-Editor

Error Marker

Failed to match exactly one schema:
 - schema:
    Failed to match exactly one schema:
     - schema:
         - object has properties "$ref" which are not allowed
     - reference:
         - object has properties "not" which are not allowed
         - object has missing required properties "$ref"
 - reference:
     - object has missing required properties "$ref"
     - object has properties "properties", "type" which are not allowed

Warning Marker:

Invalid object reference, the referenced object is not of expected type.   

Tested with

KaiZen-OpenAPI-Editor   0.8.0.201805092300  com.reprezen.swagedit.feature.feature.group
tedepstein commented 6 years ago

@jmini , thanks for the bug report! Indeed this seems to be a case where the validation (and content assist) do not allow for a schema reference, only an inline schema.

We'll fix this.

ghillairet commented 6 years ago

Looks like an issue with the schema. If we look at https://github.com/RepreZen/KaiZen-OpenAPI-Editor/blob/master/com.reprezen.swagedit.openapi3/src/com/reprezen/swagedit/openapi3/schema/schema_v3.json#L822 we see that not references #/definitions/schema. To make that work it should reference #/definitions/schemaOrReference.