Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return types #9

Open
danielburrell opened this issue Mar 12, 2015 · 0 comments
Open

Return types #9

danielburrell opened this issue Mar 12, 2015 · 0 comments
Labels

Comments

@danielburrell
Copy link
Owner

Add another config option called "returnType" and inline define the structure of the object via jsonschema. Load this in via the apispec (using type object, already done!), and then pass this to the json2pojo library for generating the necessary classes. See code snippet below

<dependency>
        <groupId>org.jsonschema2pojo</groupId>
        <artifactId>jsonschema2pojo-core</artifactId>
        <version>0.4.8</version>
    </dependency>

JCodeModel codeModel = new JCodeModel();
new SchemaMapper().generate(codeModel, "ClassName", "com.example", apiSpec.getReturnType);
codeModel.build(new File("output"));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant