swagger-api / swagger-api/swagger-parser

loosing $ref field data when using isResolveFully option

Open
#1,166 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Question
Dominant language
Java
Stars
867
Forks
560
Avg merge
2d 21h
Merged PRs (30d)
7

Description

Good day!

I'm using OpenAPIV3Parser

I'm trying to parse my openapi: "3.0.2" yaml file

When I have

parseOptions.isResolveFully = false

I get

Services
type: array
items:
  $ref: '#/components/schemas/Service'

when i set
parseOptions.isResolveFully = true
I get data without any mentioning of the head of the reference (Service):

Services
type: array
items:
  required:
  - artifactId
  - description
  - groupId
  - id
  - name
  - version
  properties:
    id:
      type: integer
      format: int64
      readOnly: true
    name:
      type: string
    description:
      type: string
    groupId:
      type: string
    artifactId:
      type: string
    version:
      pattern: (0|(?:[1-9]\d*))(?:\.(0|(?:[1-9]\d*))(?:\.(0|(?:[1-9]\d*)))?(?:\-([\w][\w\.\-_]*))?)?
      type: string

reference field becomes null. Is there any way to preserve the information about what specificaly referenced type has been Resolved Fully when option is true.

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 the parseOptions.isResolveFully path, then reproduce the issue using the OpenAPI 3.0.2 YAML shape shown in the report. Trace how the array item's $ref is handled when full resolution is enabled. Done means the resolved schema still preserves which component type was referenced, with coverage for both option values.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.