Skip to content

[Bug]: Parameters components shouldn't be inlined with resolve option set to true #2216

Open

Description

@Curs3W4ll

Description

Following the doc, the resolve option should resolve refs (for parameters usage) from other external/relative sources/files and not replace ref usage by the inline version of the parameter. However, currently, the parameter ref is replaced by an inline version, while the component is still populated to POJO components.

Affected Version

e.g. 2.1.31

Earliest version the bug appears in (if known):
Seems to never have worked as expected.

Steps to Reproduce

  1. Create the following yml files:
    1. test.yml
openapi: 3.0.3
info:
  title: Test
  description: Test
  version: 0.0.1

paths:
  /test:
    parameters:
      - $ref: './test-components.yml#/components/parameters/TestIdQueryParameter'
    get:
      summary: Get all tests
      description: List tests
      responses:
        '200':
          description: OK

2. test-components.yml

openapi: 3.0.3
info:
  title: Portfolio Management API
  description: API to manage games portfolio
  version: 0.0.1

components:
  schemas:
    TestId:
      description: Test id
      type: string
      example: 1234
  parameters:
    TestIdQueryParameter:
      name: testId
      in: query
      description: Test id
      required: false
      schema:
        $ref: './test-components.yml#/components/schemas/TestId'
  1. Use the following code to parse these files
package org.example;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.parser.OpenAPIV3Parser;
import io.swagger.v3.parser.core.models.ParseOptions;

public class Main {
    public static void main(String[] args) {
        ParseOptions options = new ParseOptions();
        options.setResolve(true);
        OpenAPI specs = new OpenAPIV3Parser().read("test.yml", null, options);

        System.out.println(specs);
    }
}
  1. Check the parsed OpenAPI object

Expected Behavior

The parameters of the endpoint in the resulting OpenAPI object should look like this:

parameters: [
  ...
  $ref = "#/components/parameters/TestIdQueryParameter,
  ...
]

Actual Behavior

The parameters of the endpoint in the resulting OpenAPI object looks like this:

parameters: [
  ...
  $ref = null,
  ...
]

Logs / Stack Traces

Environment

  • Java version: OpenJDK21
  • Build tool: Gradle
  • OS: MacOS 15.6

Additional Context

Checklist

  • I have searched the existing issues and this is not a duplicate.
  • I have provided sufficient information for maintainers to reproduce the issue.

Activity

  1. Curs3W4ll commented on Aug 5, 2025

    @Curs3W4ll
    Author

    Probably related to #2211

  2. marcelstoer commented on Aug 12, 2025

    @marcelstoer

    @Curs3W4ll I agree that this is related to what @daniel-kmiecik closed. However, to me both issues show faulty generator behavior.

  3. ewaostrowska commented on Aug 12, 2025

    @ewaostrowska
    Contributor

    Hi @Curs3W4ll
    Thank you for reporting this issue. I have analyzed it and indeed it seems that the currant behavior is not correct for the parameters with external refs. Usage-site becomes fully inlined — which matches what resolveFully is supposed to do, not resolve. This is as well not aligned with the behavior for other types such (eg. responses).

    I have crated an issue in our internal system and we will try to fix it as soon as possible. If you have any further information that could help us fix the issue that will be a great help for us!

  4. CHervaudBetclic commented on Sep 10, 2025

    @CHervaudBetclic

    Hello, any news about this @ewaostrowska ?

  5. marcelstoer commented on Jan 6, 2026

    @marcelstoer

    @CHervaudBetclic there's PR #2254 that would resolve this.

  6. nicolaideffremo commented on Jan 13, 2026

    @nicolaideffremo

    @ewaostrowska I have updated the pull request to resolve merge conflicts. Would be great to get a review and have this merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions