RepreZen / KaiZen-OpenAPI-Editor

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

".(dot)" in yaml cause java.lang.NullPointerException in Eclipse KaiZen #437

Open raytangRT opened 6 years ago

raytangRT commented 6 years ago

A .(dot) in the yaml cause the Outline viewer in Eclipse go blank

2018-04-26 14_16_57-eclipse-workspace2 - petstore yaml - eclipse ide

Environment: KaiZen OpenAPI Editor 0.8 Eclipse Photon Milestone 6 (4.8.0M6) Build id: 20180315-1217

Sample YAML File See Line 94

openapi: "3.0.0"
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT
servers:
  - url: http://petstore.swagger.io/v1
paths:
  /pets:
    get:
      summary: List all pets
      operationId: listPets
      tags:
        - pets
      parameters:
        - name: limit
          in: query
          description: How many items to return at one time (max 100)
          required: false
          schema:
            type: integer
            format: int32
      responses:
        '200':
          description: An paged array of pets
          headers:
            x-next:
              description: A link to the next page of responses
              schema:
                type: string
          content:
            application/json:    
              schema:
                $ref: "#/components/schemas/Pets"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
    post:
      summary: Create a pet
      operationId: createPets
      tags:
        - pets
      responses:
        '201':
          description: Null response
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  /pets/{petId}:
    get:
      summary: Info for a specific pet
      operationId: showPetById
      tags:
        - pets
      parameters:
        - name: petId
          in: path
          required: true
          description: The id of the pet to retrieve
          schema:
            type: string
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pets"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
components:
  schemas:
    Pet:
      required:
        - id
        - name
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string          
          example: . <------------------------------------ This
        tag:
          type: string
    Pets:
      type: array
      items:
        $ref: "#/components/schemas/Pet"
    Error:
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string

Exception in Eclipse Error Log

eclipse.buildId=4.8.0.I20180308-0630
java.version=1.8.0_161
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.javascript.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.javascript.product

org.dadacoalition.yedit
Error
Thu Apr 26 14:10:23 CST 2018
Unexpected exception: 

java.lang.NullPointerException
    at com.reprezen.swagedit.core.json.references.JsonReferenceCollector.collect(JsonReferenceCollector.java:46)
    at com.reprezen.swagedit.core.json.references.JsonReferenceValidator.validate(JsonReferenceValidator.java:52)
    at com.reprezen.swagedit.core.validation.Validator.validate(Validator.java:119)
    at com.reprezen.swagedit.core.validation.Validator.validate(Validator.java:99)
    at com.reprezen.swagedit.core.editor.JsonEditor.validateSwagger(JsonEditor.java:476)
    at com.reprezen.swagedit.core.editor.JsonEditor.validate(JsonEditor.java:452)
    at com.reprezen.swagedit.core.editor.JsonEditor.validate(JsonEditor.java:414)
    at com.reprezen.swagedit.core.editor.JsonEditor$4.doRunInWorkspace(JsonEditor.java:347)
    at com.reprezen.swagedit.core.editor.JsonEditor$SafeWorkspaceJob.runInWorkspace(JsonEditor.java:531)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)