Description
When resolving $ref in an array in additionalProperties cascading $refs are not resolved. I attached an example with file references.
Affected Version
2.1.31
Steps to Reproduce
openapi: 3.0.3
info:
description: A service with remote models
version: 1.0.o
title: A service
paths:
/foo:
get:
description: Get Flag of flags
responses:
'200':
description: ok
content:
application/json:
schema:
$ref: './model.yaml#/components/schemas/FlagsOfFlags'
openapi: 3.0.3
info:
description: Description
version: 1.0.0
title: A title
paths: {}
components:
schemas:
Flag:
type: object
description: Active flag
properties:
isActive:
type: boolean
Flags:
type: object
description: Map of flags
additionalProperties:
type: array
items:
$ref: '#/components/schemas/Flag'
FlagsOfFlags:
type: object
description: Flag of flag configuration
additionalProperties:
type: array
items:
$ref: '#/components/schemas/Flags'
Parsing with the code below reproduces the behavior.
ParseOptions options = new ParseOptions();
options.setResolve(true);
SwaggerParseResult result = new OpenAPIParser().readLocation(inputSpec, authorizationValues, options);
Expected Behavior
Have all $refs resolved in the parse result, such that they are available in #/components/
Actual Behavior
Only the FlagsOfFlags is resolved, the others are not.
Additional Context
Further investigation shows, that this branch in ExternalRefProcessor#processRefToExternalSchema prevents the wrong $ref from being blank. It should look at the items.
I can provide a PR if desired.
Checklist
Description
When resolving
$refin an array in additionalProperties cascading$refsare not resolved. I attached an example with file references.Affected Version
2.1.31
Steps to Reproduce
Parsing with the code below reproduces the behavior.
Expected Behavior
Have all
$refsresolved in the parse result, such that they are available in#/components/Actual Behavior
Only the
FlagsOfFlagsis resolved, the others are not.Additional Context
Further investigation shows, that this branch in ExternalRefProcessor#processRefToExternalSchema prevents the wrong
$reffrom being blank. It should look at the items.I can provide a PR if desired.
Checklist