• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Generate model class for spring starter

 
Greenhorn
Posts: 13
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: 13868
314
  • 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: 13
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: 22649
126
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.
 
Attractive, successful people love this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic