Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Generate model class for spring starter

 
Greenhorn
Posts: 12
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: 13182
286
  • 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: 12
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.
 
Marshal
Posts: 22394
121
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.
 
Talk sense to a fool and he calls you foolish. -Euripides A foolish tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic