Skip to content

[Bug]: Presence of path parameter in parent reference leads to unresolved examples #2244

@jhemelhof

Description

@jhemelhof

Description

When parsing an OpenAPI v3.0.3 specification that contains nested references for an operation with a path parameter the new ParseOptions().setResolve(true) method doesn't resolve the examples.

Affected Version

Current main branch, so 2.1.35

Steps to Reproduce

Given the example OpenAPI specification at https://gist.github.com/clone1612/e9ca124ca323843d0175c67a4890d5ee the following test will fail:

        OpenAPIV3Parser openApiParser = new OpenAPIV3Parser();
        ParseOptions options = new ParseOptions();
        options.setResolve(true);
        SwaggerParseResult parseResult = openApiParser.readLocation("reproducer.yaml", null, options);
        OpenAPI openAPI = parseResult.getOpenAPI();

        assertNotNull(openAPI.getComponents().getExamples());

Expected Behavior

The examples should have been resolved

Actual Behavior

The examples aren't resolved

Environment

λ java -version
openjdk version "1.8.0_452"
OpenJDK Runtime Environment (build 1.8.0_452-b09)
OpenJDK 64-Bit Server VM (build 25.452-b09, mixed mode)

λ mvn --version
Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256)
...
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

Additional Context

Discovered while attempting to fix OpenAPITools/openapi-generator#21409 but issue is located in this underlying library

Checklist

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions