KaiZen-OpenAPI-Editor icon indicating copy to clipboard operation
KaiZen-OpenAPI-Editor copied to clipboard

not and $ref is not supported

Open jmini opened this issue 7 years ago • 2 comments

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

jmini avatar Jun 09 '18 05:06 jmini

@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.

tedepstein avatar Jun 10 '18 20:06 tedepstein

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.

ghillairet avatar Jun 12 '18 10:06 ghillairet