• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Generate model class for spring starter

 
Greenhorn
Posts: 14
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am writing spring starter and need to generate model class using some schema given by client using my starter. What would be the best solution to generate model class from schema? What kind of schema is used for this kind of stuff mostly? I am not very into JAXB as it is xml. I want something like grpc which has easy&simple schema format.
 
Saloon Keeper
Posts: 14711
331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the client has already given you a schema in a certain format, do you really have a choice?
 
Omer Faruk Kurular
Greenhorn
Posts: 14
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:If the client has already given you a schema in a certain format, do you really have a choice?


No, I will force client to use my desired schema. No one gives me something I do not know or want. Could you use xml for application properties in a Spring Boot app? No. So this is similar.
 
Author
Posts: 16
5
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may use Open API Specs in YAML or JSON. Once you write them in YAML/JSON then you can use OpenAPI generator to generate the models.
 
Sheriff
Posts: 22716
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Indeed. I've used the Maven plugin (https://openapi-generator.tech/docs/plugins/) quite often. It supports multiple generators; you can find a list on https://openapi-generator.tech/docs/generators/. For the Java generators you can often configure what you want to generate, so generating only the model classes is easy.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic