Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

693
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda