swagger-api / swagger-api/swagger-parser

Automatic $ref management while calling model's methods

Open
#565 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi,
Is possible to get an automatic $ref management like this one:

  1. You have a Schema object that contains a $ref
  2. You call a method, for example schema.getName()
  3. Inside the getName() call, the objects itself checks if it's a ref with get$ref() != null
  4. If it's a ref, It automatically solves and populates itself and the function getName() returns the name solved

I think It can be achieved in a simple way subclassing the actual models and It should not create problems with circular $ref, because you solve only one "sublevel" for method call

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 by locating the Schema model and the existing getName() and get$ref() methods; the issue does not name files or tests. Read how model subclasses and reference resolution currently work, then define completion around method calls resolving one referenced level while preserving the stated circular-$ref behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.