Skip to content

Resolve of parameter $ref definition #2211

Description

@nicolaideffremo

The contract below does not resolve as I would expect, when parsed with the resolve option. The parameter reference is inlined and the components section kept as is. I would expect to keep the reference and in the case of a file or remote reference replace with a local reference.

openapi: 3.0.3
info:
  title: technical-definitions
  description: Commons technical definitions
  version: 1.0.0
servers:
  - url: https://
paths:
  /components/parameter:
    get:
      tags:
        - example
      operationId: getExampleById4
      parameters:
        - $ref: '#/components/parameters/Parameter'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Success
components:
  parameters:
    Parameter:
      name: id
      in: query
      description: The ID of the example to retrieve
      required: true
      style: form
      explode: true
      schema:
        type: string

This is reproducible with the parser configuration below:

var parser = new OpenAPIV3Parser();
var options = new ParseOptions();
options.setResolve(true);

parser.readContents(contract, Collections.emptyList(), options);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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