Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

696
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!