swagger-api / swagger-api/swagger-codegen
refer to properties in $ref get Compilation error in generated class although it is valid swagger yml
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Mustache
- Estrellas
- 17.8k
- Forks
- 6k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
From @noha-gamal on February 12, 2019 13:56
Q&A (please complete the following information)
- OS: [e.g. Windows 10 Enterprise]
- Browser: [e.g. chrome]
- Version: [e.g. 71.0.3578.98]
- Method of installation: [use online swagger editor https://editor.swagger.io/]
- Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0]
Content & configuration
Example Swagger/OpenAPI definition:
swagger: '2.0'
host: api.vodafone.com
basePath: '/{access}/eligibleProductOfferingAPI/v2'
schemes:
- https
consumes:
- application/json
produces:
- application/json
info:
title: 'Common Service Model API: EligibleProductOffering'
version: 2.1.0
paths:
/eligibleProductOffering:
get:
tags:
- eligibleProductOffering
description: >-
A method that allows a consumer of the API to get-list a
EligibleProductOffering representation.
operationId: getList
produces:
- application/json
responses:
'204':
description: '204, No Content.'
definitions:
eligibleProductOfferingVBOProductOffering:
properties:
id:
type: array
minItems: 1
items:
$ref: '#/definitions/BasicComponents/properties/IDType'
name:
type: string
description: ' The name of the instance of a business object or component.'
BasicComponents:
properties:
IDType:
type: object
properties:
value:
type: string
description: The value of the field.
schemeID:
type: string
schemeName:
type: string
schemeAgencyName:
type: string
required:
- value
Describe the bug you're encountering
Bug is in class EligibleProductOfferingVBOProductOffering.java get id attribute
private List id = null;
where class BasicComponentspropertiesIDType not found.
expected attribute id with type BasicComponentsIDType
To reproduce...
Steps to reproduce the behavior:
- Go to 'https://editor.swagger.io/'
- Paste above yml
4.Click on Generate Server then Spring
5.Spring-server-generated.zip downloaded, open it and go to spring-server\src\main\java\io\swagger\model\EligibleProductOfferingVBOProductOffering.java - Found compilation error in class generated.
Expected behavior
expected that id attribute in EligibleProductOfferingVBOProductOffering.java be
private List id = null;
instead of
private List id = null;
Copied from original issue: swagger-api/swagger-ui#5175
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Reproduzca el problema en https://editor.swagger.io/ con el YAML de Swagger 2.0 proporcionado y, a continuación, inspeccione el archivo generado spring-server/src/main/java/io/swagger/model/EligibleProductOfferingVBOProductOffering.java. Compare la declaración id generada con la referencia esperada BasicComponentsIDType y verifique que el servidor Spring generado compila sin la clase BasicComponentspropertiesIDType faltante.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java, spring
- Área
- backend-api-design, tooling
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 35/100