swagger-api / swagger-api/swagger-codegen
[Spring] Codegen 2.2.2 does not render objects comprised by allOf and containing additionalProperties:
Nessuno ha ancora preso questa issue.
- Lingua principale
- Mustache
- Stelle
- 17.8k
- Fork
- 6k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Description
When running Codegen 2.2.2 to render Spring objects, when the object has a definition using the allOf schema attribute and also the additionalProperties attribute, the rendered Java object contains no members at all.
Swagger-codegen version
swagger-codegen-cli-2.2.2.jar
Swagger declaration file content or url
DynamicAccountModel:
allOf:
- properties:
accountId:
type: string
description: Account ID
- additionalProperties:
type: string
Command line used for generation
java -jar ../tools/swagger-codegen-cli-2.2.2.jar generate -i allof-no-render.yaml -l spring -o target
Steps to Reproduce
Execute above command.
Note that the class contains neither derives from HashMap (due to having the additionalParameters attribute) nor contains an accountId member.
package com.foo.bar;
import java.util.Objects;
import java.io.Serializable;
import javax.validation.constraints.*;
/**
* DynamicAccountModel
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2017-03-30T07:57:06.421-04:00")
public class DynamicAccountModel implements Serializable {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return true;
}
@Override
public int hashCode() {
return Objects.hash();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DynamicAccountModel {\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia eseguendo il comando documentato swagger-codegen-cli-2.2.2 con lo YAML allOf/additionalProperties fornito e ispeziona la classe Java Spring generata. Segui il percorso del generatore Spring responsabile di questo modello; il lavoro è completo quando la classe include accountId e gestisce le proprietà aggiuntive come descritto, invece di generare un oggetto vuoto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java, spring
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100