swagger-api / swagger-api/swagger-codegen
[spring] Extenal schema file interpreted incorrectly
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.3.0</version>
</dependency>
In the following config I have an external schema file defined - $ref: 'file-event.yaml'
paths:
/files:
post:
operationId: addFile
consumes:
- application/json
parameters:
- in: body
name: body
required: true
schema:
$ref: 'file-event.yaml'
responses:
'200':
description: successful operation
This is interpreted incorrectly by the plugin which is expecting the schema to be the part of the "definitions" within the same file.
"jsonSchema" : "{\r\n "in" : "body",\r\n "name" : "body",\r\n "description" : "File event to add to the TaskManager",\r\n "required" : true,\r\n "schema" : {\r\n "$ref" : "#/definitions/file-event.yaml"\r\n }\r\n}",
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 with the swagger-codegen-maven-plugin handling of the external file-event.yaml $ref shown in the issue, and compare it with how local definitions are resolved. Done means the external schema remains an external reference rather than being rewritten as #/definitions/file-event.yaml; no repository test or source file is named in the report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- spring
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100