Skip to content

Return types #9

@danielburrell

Description

@danielburrell

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"));

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions