swagger-api / swagger-api/swagger-parser
'#/paths/~1path/get/requestBody/content/application~1json/schema' not resolved with ResolverFully
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
Bug
The local refs to another schema inside a path definition is not resolved using ResolverFully. This types of refs are discouraged, but they can be done according to spec and docs https://swagger.io/docs/specification/using-ref/
Steps to reproduce
Try to load with setResolveFully true this spec:
openapi: 3.0.0
info:
version: 1.0.0
title: JSON Schemas test spec
license:
name: MIT
paths:
/test1:
get:
operationId: test1
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Person'
responses:
default:
description: "OK"
/test4:
get:
operationId: test4
responses:
default:
description: "OK"
requestBody:
content:
application/json:
schema:
allOf:
- $ref: '#/paths/~1test1/get/requestBody/content/application~1json/schema'
- $ref: '#/components/schemas/Citizen'
components:
schemas:
Person:
type: object
additionalProperties: {}
properties:
name:
type: string
surname:
type: string
required:
- name
- surname
Citizen:
type: object
additionalProperties: {}
properties:
id_card:
type: string
required:
- id_card
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by loading the supplied OpenAPI YAML with setResolveFully(true) and inspect ResolverFully's handling of the local path reference in /test4. Trace why '#/paths/1test1/get/requestBody/content/application1json/schema' is not resolved, then verify that the request-body schema resolves successfully without breaking the components-schema references.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100