Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

697
Visualizações
How to implement inheritance with openapi-generator-maven-plugin

I'm trying to generate Java model with inheritance (Open API 2.0). The problem is similar to this one: How do you have the maven swagger codegen plugin generate Java classes using inheritance?

I want to achieve inheritance without discriminator attribute. Why this field has to be pointed in the parent class? Moreover according to docs:

The discriminator Fixed Field must reference a property from the same schema, and that it must be a required property

I DO NOT want to point any required fields. I just want to obtain inheritance. Is there any other way to do that? I know some "workaround" would be to change level of attributes:

"Child": {
  "allOf": [
    {"$ref": "#/components/schemas/Parent"},
  ],
  "properties": {.......}
}

But this is rather against the specs. Most surprising part is it works for openapi-generator-maven-plugin but in this time doesn't generate the correct code if we put "required" list. List of required fields will be omitted but inheritance will generate correctly.

Is there any other way to generate the proper inheritance without discriminator?

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda