OpenAPITools / OpenAPITools/openapi-generator

[BUG] Parsing Remote Reference (Filesystem) openapi 3.0 yaml File produces NPE

Open
#6,106 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

I am getting JsonParseException while parsing Remote Reference (Filesystem) yaml File ($ref: './model.yaml#/components/schemas/Model')

openapi-generator version

4.3.0

openapi.yaml
openapi: "3.0.0"
info:
  version: 1.0.0
  title: TODO
servers:
  - url: TODO
paths:
  /konten/method3:
    post:
      operationId: javaMethodName
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: './model.yaml#/components/schemas/Model'
model.yaml (no openapi: 3.0.0 on 1st line)
components:
  schemas:
    Model:
      type: object
      properties:
        integerMember:
          type: integer
          format: int32

Both files are located in the same directory

It seems that the Message "attribute openapi is missing" in OpenAPIV3Parser causes the problem!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with OpenAPIV3Parser and reproduce the issue using the provided openapi.yaml and model.yaml files, with the filesystem $ref and no openapi field in model.yaml. Trace how the missing openapi attribute is handled during remote-reference parsing. Done means the referenced schema parses without a JsonParseException or NullPointerException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, yaml
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.