Skip to content
This repository was archived by the owner on Oct 26, 2026. It is now read-only.
This repository was archived by the owner on Oct 26, 2026. It is now read-only.

Generate enum as enum for Java #248

Open

Description

@martin-martinez-thrive

Hi 👋
using the following schema for a test event:
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "labels": { "section": "auth" }, "description": "Testing Events with accepted values", "properties": { "context": { "id": "/properties/context" }, "traits": { "type": "object", "id": "/properties/traits" }, "properties": { "type": "object", "properties": { "backpack_contents": { "description": "What are you taking on your trip", "id": "/properties/properties/properties/backpack_contents", "properties": { "item_name": { "description": "Item name", "enum": [ "food", "raincoat", "salami", "tootbrush" ], "id": "/properties/properties/properties/backpack_contents/properties/item_name", "type": "string" }, "weight": { "description": "How heavy is the backpack", "id": "/properties/properties/properties/backpack_contents/properties/weight", "type": "integer" } }, "required": [], "type": "object" }, "heading": { "description": "Heading direction", "enum": [ "east", "north", "south", "west" ], "id": "/properties/properties/properties/heading", "type": "string" }, "trip_name": { "description": "A descriptive name for the trip, example: \"Road trip to Vegas\"", "id": "/properties/properties/properties/trip_name", "pattern": "([A-Z])\\w+", "type": "string" } }, "id": "/properties/properties" } } }

the generated code for Java, TestEvent.Builder takes heading as a String. Ideally this should be an enum with 4 options so clients shouldn't have these values hard-coded, which would also prevent other values to be added.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions