swagger-api / swagger-api/swagger-parser
VendorExtensions are not parsed properly
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
in case an object property is defined as a $ref and has vendor extensions, the extensions are ignored during parsing. The same happens for arrays.
swagger: '2.0'
info:
description: 'Good'
version: '2.0.0'
title: 'Test'
paths:
/foo:
post:
responses:
200:
description: 'OK'
definitions:
Interval:
type: object
properties:
start:
type: number
x-custom: true
finish:
type: number
distance_type:
type: object
properties:
name:
type: string
x-custom: true
Distance:
type: object
properties:
interval:
x-custom: true //<- HERE
$ref: "#/definitions/Interval"
Run:
type: object
properties:
distance:
x-custom: true
$ref: "#/definitions/Distance"
Competition:
type: object
properties:
runs:
x-custom: true
type: array
items:
$ref: "#/definitions/Run"
x-cusom in Run->Distance, and Distance->Interval are lost
The patch is attached.
Issue_#798_fix_parsing_vendor_extensions_in_case_of_an_object_is_defined_as_$ref_and_array.patch.txt
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
No source file or test is named in the issue. Start by reproducing the supplied Swagger YAML and trace parsing of $ref properties and array items; done means the x-custom extensions on the referenced object and array cases are preserved rather than ignored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100