### GET /api/meta Source: https://github.com/liftwizard/klass/blob/main/docs/part3/5_dynamic_model.md Fetches the bootstrapped model. ```APIDOC ## GET /api/meta ### Description Fetches the bootstrapped model. ### Method GET ### Endpoint /api/meta ### Response #### Success Response (200) - **model** (object) - The bootstrapped model data. ``` -------------------------------- ### JSON Response Format Example Source: https://github.com/liftwizard/klass/blob/main/docs/src/main/znai/vision/projections-and-services.md Example of a JSON response body generated from a Klass service with 'format: json'. The structure mirrors the defined projection. ```json { "id": 1, "title": "Question title 1", "body": "Question body 1", "answers": [ { "id": 1, "body": "Answer body 1" }, { "id": 2, "body": "Answer body 2" } ] } ``` -------------------------------- ### Example JSON Response Structure Source: https://context7.com/liftwizard/klass/llms.txt Represents a typical JSON response for a GET request, including nested projections, temporal metadata, and audit fields. ```json { "id": 1, "title": "example title", "body": "example body", "systemFrom": "2017-12-31T23:59:59.000Z", "systemTo": null, "createdById": "Alice", "createdOn": "2017-12-31T23:59:59.000Z", "lastUpdatedById": "Bob", "answers": [ { "id": 1, "body": "Answer body 1" }, { "id": 2, "body": "Answer body 2" } ], "version": { "number": 2, "systemFrom": "2018-01-01T23:59:59.000Z", "systemTo": null, "createdById": "Alice", "createdOn": "2017-12-31T23:59:59.000Z", "lastUpdatedById": "Bob" } } ``` -------------------------------- ### Klass Compiler Error Message Example Source: https://context7.com/liftwizard/klass/llms.txt This example shows the detailed error output from the Klass compiler, including the error code, message, location, and a contextual code snippet with an ASCII art pointer. ```text ================================== ERR_ASS_PLU ================================== Error: Expected to-many association end 'Question.answer' to have a plural name, but name exactly matched type association end type 'Answer'. At (stackoverflow.klass:158) 6| package com.stackoverflow 155| association QuestionHasAnswer 156| { 158| answer : Answer[0..*] | ^^^^^^ 159| orderBy: this.id ascending; 160| } Location: stackoverflow.klass:158 File: file:/.../stackoverflow.klass Line: 158 Character: 5 ================================================================================= ``` -------------------------------- ### GET /user Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-dropwizard-application/src/test/resources/cool/klass/xample/coverage/dropwizard/test/cool.klass.xample.coverage.dropwizard.test.SourceCodeResourceTest Retrieves a list of all users. ```APIDOC ## GET /user ### Description Retrieves a collection of all users in the system. ### Method GET ### Endpoint /user ``` -------------------------------- ### GET /question/in Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/klass-generator-klass-html-test/src/test/resources/cool/klass/generator/klass/html/test/stackoverflow.klass.html Retrieves multiple questions by a list of IDs. ```APIDOC ## GET /question/in ### Description Retrieves multiple questions based on a provided list of IDs. ### Method GET ### Endpoint /question/in ### Parameters #### Query Parameters - **ids** (Long[]) - Optional - A list of question IDs. ``` -------------------------------- ### Example JSON Response with Parameterized Fields Source: https://github.com/liftwizard/klass/blob/main/docs/src/main/znai/additional-features/overview.md Shows how parameterized properties appear in the resulting JSON output. ```json { "id": 1, "title": "Question title 1", "body": "Question body 1", "votesByDirection(up)": [ { "user": { "userId": "Example user id" } } ], "votesByDirection(down)": [], "voteByUser(Example user id)": { "direction": "up" } } ``` -------------------------------- ### JSON Response with Parameterized Fields Source: https://github.com/liftwizard/klass/blob/main/docs/part4/README.md Shows an example JSON response where parameterized properties are represented with their parameters included in the field names, like `votesByDirection(up)` and `voteByUser(Example user id)`. ```json { "id": 1, "title": "Question title 1", "body": "Question body 1", "votesByDirection(up)": [ { "user": { "userId": "Example user id" } } ], "votesByDirection(down)": [], "voteByUser(Example user id)": { "direction": "up" } } ``` -------------------------------- ### GET /properties-required Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-klass-html/src/test/resources/cool/klass/xample/coverage/html/coverage-example.klass.html Retrieves a list of all PropertiesRequired resources. ```APIDOC ## GET /properties-required ### Description Retrieves a collection of all PropertiesRequired resources. ### Method GET ### Endpoint /properties-required ``` -------------------------------- ### Define a Stack Overflow domain model in Klass Source: https://github.com/liftwizard/klass/blob/main/docs/README.md This example demonstrates a domain model including users, enumerations, interfaces, classes, associations, projections, and RESTful service definitions. ```klass /* * Simplified StackOverflow domain model. One question has many answers. */ package com.stackoverflow // 'user' is a special class that represents logged-in users. user User read systemTemporal { userId : String key userId; firstName : String?; lastName : String?; email : String?; } enumeration Status { OPEN("Open"), ON_HOLD("On hold"), CLOSED("Closed"), } interface Document { id : Long key id; body : String; } class Question implements Document read(QuestionReadProjection) systemTemporal versioned audited { id : Long key id; title : String; status : Status; deleted : Boolean; } class Answer implements Document systemTemporal versioned audited { id : Long key id; questionId : Long private final; deleted : Boolean; } association QuestionHasAnswer { question : Question[1..1] final; answers : Answer[0..*] orderBy: this.id ascending; } // A Projection defines the shape of the data returned by an API. projection AnswerProjection on Answer { id: "Answer id", body: "Document body", deleted: "Answer deleted", } projection QuestionReadProjection on Question { id : "Question id", title : "Question title", body : "Document body", status : "Question status", deleted : "Question is deleted", answers : AnswerProjection, } // A Service defines a RESTful API endpoint. service QuestionResource on Question { /question/{id: Long[1..1]} GET { multiplicity: one; criteria : this.id == id; projection : QuestionReadProjection; } /question POST { multiplicity: one; } /question/{id: Long[1..1]} PUT { multiplicity: one; criteria : this.id == id; } DELETE { multiplicity: one; criteria : this.id == id; authorize : this.createdById == user; } } ``` -------------------------------- ### Configure Service for CSV Output Source: https://context7.com/liftwizard/klass/llms.txt Define a service endpoint to return data in CSV format. This example shows how to specify the CSV format and includes a sample CSV output. ```klass service QuestionResource on Question { /question/{id: Long[1..1]} GET { multiplicity: one; criteria : this.id == id; projection : QuestionReadProjection; format : csv; } } ``` ```csv "Question id", "Question title", "Question body", "Answer id", "Answer body" 1, "Question title 1", "Question body 1", 1, "Answer body 1" 1, "Question title 1", "Question body 1", 2, "Answer body 2" ``` -------------------------------- ### GET /question Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/klass-generator-klass-html-test/src/test/resources/cool/klass/generator/klass/html/test/stackoverflow.klass.html Retrieves a list of questions based on specified criteria and projection. ```APIDOC ## GET /question ### Description Retrieves a list of questions where the title starts with 'Why do'. ### Method GET ### Endpoint /question ### Query Parameters - **criteria** (string) - Optional - Filters questions where the title starts with 'Why do'. - **projection** (string) - Optional - Specifies the projection to use, e.g., 'QuestionReadProjection'. ### Response #### Success Response (200) - **questions** (array) - A list of question objects matching the criteria. #### Response Example { "questions": [ { "id": "1", "title": "Why do we need this?", "createdOn": "2023-10-27T10:00:00Z" } ] } ``` -------------------------------- ### GET /question/{id} Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/klass-generator-klass-html-test/src/test/resources/cool/klass/generator/klass/html/test/stackoverflow.klass.html Retrieves a question by its ID. ```APIDOC ## GET /question/{id} ### Description Retrieves a question by its ID using the QuestionReadProjection. ### Method GET ### Endpoint /question/{id} ### Parameters #### Path Parameters - **id** (Long) - Required - The ID of the question. ``` -------------------------------- ### Execute Dynamic Query via GET Source: https://github.com/liftwizard/klass/blob/main/docs/part3/3_dynamic_query.md Perform ad-hoc queries directly from a browser using URL query parameters. ```text /api/meta/query/json/Question?multiplicity=many&criteria=this.title startsWith "Why do"&include=this.title ``` -------------------------------- ### GET /propertiesOptional/{propertiesOptionalId} Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-klass-html/src/test/resources/cool/klass/xample/coverage/html/coverage-example.klass.html Retrieves a specific PropertiesOptional resource by its ID. ```APIDOC ## GET /propertiesOptional/{propertiesOptionalId} ### Description Retrieves a single PropertiesOptional resource identified by the provided ID. ### Method GET ### Endpoint /propertiesOptional/{propertiesOptionalId} ### Parameters #### Path Parameters - **propertiesOptionalId** (Long) - Required - The unique identifier of the resource. ``` -------------------------------- ### Macro Generation Trace Example Source: https://github.com/liftwizard/klass/blob/main/docs/README.md Illustrates an error report from the Klass compiler, tracing an error in macro-generated code back to the original source. This helps in debugging issues arising from macro expansions. ```text ════════════════════════════════════════ ERR_PRP_MOD ════════════════════════════════════════ Error: Multiple properties on 'Question' with modifiers [version]. At (Version association macro) 1║ package com.stackoverflow 3║ association QuestionHasVersion 4║ { 6║ version: QuestionVersion[1..1] owned version; ║ ^^^^^^^ 9║ } Which was generated by macro at location (stackoverflow.klass:31) 1║ package com.stackoverflow ... 28║ class Question ... 31║ versioned ║ ^^^^^^^^^ ... 38║ } Location: stackoverflow.klass:31 File: stackoverflow.klass Line: 31 Character: 5 ═════════════════════════════════════════════════════════════════════════════════════════════ ``` -------------------------------- ### Initialize Swagger UI Source: https://github.com/liftwizard/klass/blob/main/klass-dropwizard/klass-dropwizard-bundles/klass-dropwizard-bundle-swagger-ui/src/main/resources/swagger-ui-custom/index.html Use this JavaScript code to initialize the Swagger UI for the Klass API. Ensure the 'url' points to your swagger.json file. This setup is typically used for API documentation and testing. ```javascript window.onload = function () { // Begin Swagger UI call region const ui = SwaggerUIBundle({ url: "/api/swagger.json", dom_id: '#swagger-ui', deepLinking: true, presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset], plugins: [SwaggerUIBundle.plugins.DownloadUrl], layout: "StandaloneLayout" }); // End Swagger UI call region window.ui = ui; }; ``` -------------------------------- ### GET /everyTypeKeyProperty Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-dropwizard-application/src/test/resources/cool/klass/xample/coverage/dropwizard/test/cool.klass.xample.coverage.dropwizard.test.SourceCodeResourceTest Retrieves a collection of EveryTypeKeyProperty entities based on specified criteria. ```APIDOC ## GET /everyTypeKeyProperty ### Description Retrieves a collection of EveryTypeKeyProperty entities. Supports fetching all entities and applying criteria. ### Method GET ### Endpoint /everyTypeKeyProperty ### Parameters #### Query Parameters - **criteria** (string) - Optional - Specifies the criteria for filtering the entities. Defaults to 'all'. - **projection** (string) - Optional - Specifies the projection to be used for the response. Defaults to 'EveryTypeKeyPropertyProjection'. ### Response #### Success Response (200) - **EveryTypeKeyPropertyProjection** (object) - An array of EveryTypeKeyProperty objects, potentially with a specific projection applied. #### Response Example { "example": "[\n {\n \"keyString\": \"string\",\n \"keyInteger\": 0,\n \"keyLong\": 0,\n \"keyDouble\": 0.0,\n \"keyFloat\": 0.0,\n \"keyBoolean\": true,\n \"keyInstant\": \"2023-10-27T10:00:00Z\",\n \"keyLocalDate\": \"2023-10-27\",\n \"everyTypeForeignKeyProperties\": {\n \"id\": \"string\",\n \"foreignKeyString\": \"string\",\n \"foreignKeyInteger\": 0,\n \"foreignKeyLong\": 0,\n \"foreignKeyDouble\": 0.0,\n \"foreignKeyFloat\": 0.0,\n \"foreignKeyBoolean\": true,\n \"foreignKeyInstant\": \"2023-10-27T10:00:00Z\",\n \"foreignKeyLocalDate\": \"2023-10-27\",\n \"data\": \"string\"\n },\n \"version\": {\n \"number\": 0\n }\n }\n]" } ``` -------------------------------- ### Retrieve Question class metadata via JSON Source: https://github.com/liftwizard/klass/blob/main/docs/src/main/znai/bootstrapped-metamodel/bootstrapped-model-data.md Example of the JSON structure returned when querying the Question class metadata. ```json { "name": "Question", "inferred": false, "packageName": "com.stackoverflow", "ordinal": 1, "sourceCode": "class Question\n systemTemporal\n versioned\n audited\n{\n id : Long key id;\n title : String;\n body : String;\n system : TemporalRange system;\n systemFrom : TemporalInstant system from;\n systemTo : TemporalInstant system to;\n createdById : String private createdBy;\n createdOn : Instant createdOn;\n lastUpdatedById : String private lastUpdatedBy;\n answers: Answer[0..*]\n orderBy: this.id ascending;\n version: QuestionVersion[1..1] version;\n}\n", "classifierModifiers": [ { "name": "systemTemporal", "inferred": false, "ordinal": 1 }, { "name": "versioned", "inferred": false, "ordinal": 2 }, { "name": "audited", "inferred": false, "ordinal": 3 } ], "primitiveProperties": [ { "name": "id", "inferred": false, "primitiveType": "Long", "optional": false, "key": true, "id": true, "ordinal": 1, "primitivePropertyModifiers": [ { "name": "key", "inferred": false, "ordinal": 1 }, { "name": "id", "inferred": false, "ordinal": 2 } ] }, { "name": "title", "inferred": false, "primitiveType": "String", "optional": false, "key": false, "id": false, "ordinal": 2, "primitivePropertyModifiers": [] }, { "name": "body", "inferred": false, "primitiveType": "String", "optional": false, "key": false, "id": false, "ordinal": 3, "primitivePropertyModifiers": [] }, { "name": "system", "inferred": false, "primitiveType": "TemporalRange", "optional": false, "key": false, "id": false, "ordinal": 4, "primitivePropertyModifiers": [ { "name": "system", "inferred": false, "ordinal": 1 } ] }, { "name": "systemFrom", "inferred": false, "primitiveType": "TemporalInstant", "optional": false, "key": false, "id": false, "ordinal": 5, "primitivePropertyModifiers": [ { "name": "system", "inferred": false, "ordinal": 1 }, { "name": "from", "inferred": false, "ordinal": 2 } ] }, { "name": "systemTo", "inferred": false, "primitiveType": "TemporalInstant", "optional": false, "key": false, "id": false, "ordinal": 6, "primitivePropertyModifiers": [ { "name": "system", "inferred": false, "ordinal": 1 }, { "name": "to", "inferred": false, "ordinal": 2 } ] }, { "name": "createdById", "inferred": false, "primitiveType": "String", "optional": false, "key": false, "id": false, "ordinal": 7, "primitivePropertyModifiers": [ { "name": "private", "inferred": false, "ordinal": 1 }, { "name": "createdBy", "inferred": false, "ordinal": 2 } ] }, { "name": "createdOn", "inferred": false, "primitiveType": "Instant", "optional": false, "key": false, "id": false, "ordinal": 8, "primitivePropertyModifiers": [] } ``` -------------------------------- ### GET /api/question/{id} Source: https://github.com/liftwizard/klass/blob/main/docs/part2/2_audited_services.md Retrieves a question by ID, optionally filtered by version. ```APIDOC ## GET /api/question/{id} ### Description Retrieves the full body of a question. If the version parameter is provided, it returns that specific historical version. ### Method GET ### Endpoint /api/question/{id} ### Parameters #### Path Parameters - **id** (long) - Required - The ID of the question #### Query Parameters - **version** (integer) - Optional - The specific version number to retrieve ### Response #### Success Response (200) - **id** (long) - Question ID - **title** (string) - Question title - **body** (string) - Question body - **systemFrom** (string) - Start timestamp - **systemTo** (string) - End timestamp (null if active) - **version** (object) - Version metadata ``` -------------------------------- ### GET /api/meta/query/json/{className} Source: https://github.com/liftwizard/klass/blob/main/docs/part3/3_dynamic_query.md Executes a dynamic query using URL query parameters for easier browser-based experimentation. ```APIDOC ## GET /api/meta/query/json/{className} ### Description Executes a dynamic query using URL query parameters. ### Method GET ### Endpoint /api/meta/query/json/{className} ### Parameters #### Path Parameters - **className** (string) - Required - The name of the class to query. #### Query Parameters - **multiplicity** (string) - Required - The expected multiplicity. - **criteria** (string) - Required - The query criteria string. - **include** (string) - Optional - The projection fields to include. ``` -------------------------------- ### JSON Response Format Source: https://github.com/liftwizard/klass/blob/main/docs/part1/3_projections_and_services.md Example of the nested JSON structure generated by a service using a projection. ```json { "id": 1, "title": "Question title 1", "body": "Question body 1", "answers": [ { "id": 1, "body": "Answer body 1" }, { "id": 2, "body": "Answer body 2" } ] } ``` -------------------------------- ### Build and Run KlassModelBootstrapped Source: https://github.com/liftwizard/klass/blob/main/klass-models/klass-model-bootstrapped/klass-model-bootstrapped-dropwizard-application/README.md Commands to compile the project and launch the Dropwizard server using a configuration file. ```bash mvn clean install ``` ```bash java -jar target/klass-model-bootstrapped-dropwizard-application-dropwizard-application-0.1.0-SNAPSHOT.jar server config.yml ``` -------------------------------- ### Initialize GraphiQL React Component Source: https://github.com/liftwizard/klass/blob/main/klass-reladomo/klass-bundle-graphql/src/main/resources/graphiql/index.htm Mounts the GraphiQL component to the DOM with a configured GraphQL fetcher and explorer plugin. ```javascript const root = ReactDOM.createRoot(document.getElementById("graphiql")); const fetcher = GraphiQL.createFetcher({ url: "/graphql", }); const explorerPlugin = GraphiQLPluginExplorer.explorerPlugin(); root.render( React.createElement(GraphiQL, { fetcher, defaultEditorToolsVisibility: true, plugins: [explorerPlugin], }), ); ``` -------------------------------- ### POST /everyTypeKeyProperty/multiple Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-klass-html/src/test/resources/cool/klass/xample/coverage/html/coverage-example.klass.html Creates multiple EveryTypeKeyProperty records. ```APIDOC ## POST /everyTypeKeyProperty/multiple ### Description Creates multiple EveryTypeKeyProperty records. ### Method POST ### Endpoint /everyTypeKeyProperty/multiple ### Parameters #### Request Body - **records** (array) - Required - An array of EveryTypeKeyProperty objects to create. - Each object in the array should follow the structure defined for the POST /everyTypeKeyProperty/single endpoint. ### Request Example { "example": "{\n \"records\": [\n {\n \"keyString\": \"record1String\",\n \"keyInteger\": 1,\n \"keyLong\": 10,\n \"keyDouble\": 1.1,\n \"keyFloat\": 1.11,\n \"keyBoolean\": true,\n \"keyInstant\": \"2023-10-27T10:30:00Z\",\n \"keyLocalDate\": \"2023-10-27\",\n \"everyTypeForeignKeyProperties\": {\n \"id\": \"fk1\",\n \"data\": \"data1\"\n },\n \"version\": {\n \"number\": 1\n }\n },\n {\n \"keyString\": \"record2String\",\n \"keyInteger\": 2,\n \"keyLong\": 20,\n \"keyDouble\": 2.2,\n \"keyFloat\": 2.22,\n \"keyBoolean\": false,\n \"keyInstant\": \"2023-10-27T11:00:00Z\",\n \"keyLocalDate\": \"2023-10-27\",\n \"everyTypeForeignKeyProperties\": {\n \"id\": \"fk2\",\n \"data\": \"data2\"\n },\n \"version\": {\n \"number\": 1\n }\n }\n ]\n}" } ### Response #### Success Response (200) - **message** (string) - Confirmation message of successful creation. #### Response Example { "example": "{\"message\": \"Multiple EveryTypeKeyProperty records created successfully.\"}" } ``` -------------------------------- ### Create Resource via POST Source: https://context7.com/liftwizard/klass/llms.txt Creates a new resource at the collection endpoint. ```bash # Create a new question curl -X POST http://localhost:8080/api/question \ -H "Content-Type: application/json" \ -d '{ "title": "example title", "body": "example body" }' # Response: 201 Created # Location: http://localhost:8080/api/question/1 ``` -------------------------------- ### POST /everyTypeKeyProperty/multiple Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-dropwizard-application/src/test/resources/cool/klass/xample/coverage/dropwizard/test/cool.klass.xample.coverage.dropwizard.test.SourceCodeResourceTest Creates multiple EveryTypeKeyProperty entities. ```APIDOC ## POST /everyTypeKeyProperty/multiple ### Description Creates multiple EveryTypeKeyProperty entities in a single request. ### Method POST ### Endpoint /everyTypeKeyProperty/multiple ### Request Body - **EveryTypeKeyProperty[]** (array) - Required - An array of EveryTypeKeyProperty objects to be created. ### Request Example { "example": "[\n {\n \"keyString\": \"exampleString1\",\n \"keyInteger\": 101\n },\n {\n \"keyString\": \"exampleString2\",\n \"keyInteger\": 102\n }\n]" } ### Response #### Success Response (200 or 201) - **ids** (array) - An array of strings, where each string is the unique identifier of a created EveryTypeKeyProperty entity. #### Response Example { "example": "{\"ids\": [\"generated-id-456\", \"generated-id-789\"]}" } ``` -------------------------------- ### POST /everyTypeKeyProperty/single Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-klass-html/src/test/resources/cool/klass/xample/coverage/html/coverage-example.klass.html Creates a single EveryTypeKeyProperty record. ```APIDOC ## POST /everyTypeKeyProperty/single ### Description Creates a single EveryTypeKeyProperty record. ### Method POST ### Endpoint /everyTypeKeyProperty/single ### Parameters #### Request Body - **keyString** (string) - Required - The string key property. - **keyInteger** (integer) - Required - The integer key property. - **keyLong** (long) - Required - The long key property. - **keyDouble** (double) - Required - The double key property. - **keyFloat** (float) - Required - The float key property. - **keyBoolean** (boolean) - Required - The boolean key property. - **keyInstant** (instant) - Required - The instant key property. - **keyLocalDate** (localDate) - Required - The local date key property. - **everyTypeForeignKeyProperties** (object) - Required - The foreign key properties. - **id** (string) - Required - The ID of the foreign key property. - **foreignKeyString** (string) - Optional - The string foreign key. - **foreignKeyInteger** (integer) - Optional - The integer foreign key. - **foreignKeyLong** (long) - Optional - The long foreign key. - **foreignKeyDouble** (double) - Optional - The double foreign key. - **foreignKeyFloat** (float) - Optional - The float foreign key. - **foreignKeyBoolean** (boolean) - Optional - The boolean foreign key. - **foreignKeyInstant** (instant) - Optional - The instant foreign key. - **foreignKeyLocalDate** (localDate) - Optional - The local date foreign key. - **data** (string) - Optional - Additional data for the foreign key property. - **version** (object) - Required - The version information. - **number** (integer) - Required - The version number. ### Request Example { "example": "{\n \"keyString\": \"exampleString\",\n \"keyInteger\": 123,\n \"keyLong\": 456789,\n \"keyDouble\": 1.23,\n \"keyFloat\": 4.56,\n \"keyBoolean\": true,\n \"keyInstant\": \"2023-10-27T10:30:00Z\",\n \"keyLocalDate\": \"2023-10-27\",\n \"everyTypeForeignKeyProperties\": {\n \"id\": \"fk123\",\n \"foreignKeyString\": \"fkString\",\n \"foreignKeyInteger\": 456,\n \"foreignKeyLong\": 789012,\n \"foreignKeyDouble\": 7.89,\n \"foreignKeyFloat\": 10.11,\n \"foreignKeyBoolean\": false,\n \"foreignKeyInstant\": \"2023-10-27T11:00:00Z\",\n \"foreignKeyLocalDate\": \"2023-10-27\",\n \"data\": \"some data\"\n },\n \"version\": {\n \"number\": 1\n }\n}" } ### Response #### Success Response (200) - **message** (string) - Confirmation message of successful creation. #### Response Example { "example": "{\"message\": \"EveryTypeKeyProperty created successfully.\"}" } ``` -------------------------------- ### GET /api/meta/code/element/ClassHasClassesWithDerivedProperty Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-dropwizard-application/src/test/resources/cool/klass/xample/coverage/dropwizard/test/cool.klass.xample.coverage.dropwizard.test.SourceCodeResourceTest Retrieves metadata for the ClassHasClassesWithDerivedProperty association. ```APIDOC ## GET /api/meta/code/element/ClassHasClassesWithDerivedProperty ### Description Retrieves the metadata definition for the association between ClassOwningClassWithDerivedProperty and ClassWithDerivedProperty. ### Method GET ### Endpoint /api/meta/code/element/ClassHasClassesWithDerivedProperty ``` -------------------------------- ### POST /everyTypeKeyProperty/single Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-dropwizard-application/src/test/resources/cool/klass/xample/coverage/dropwizard/test/cool.klass.xample.coverage.dropwizard.test.SourceCodeResourceTest Creates a single EveryTypeKeyProperty entity. ```APIDOC ## POST /everyTypeKeyProperty/single ### Description Creates a single EveryTypeKeyProperty entity. ### Method POST ### Endpoint /everyTypeKeyProperty/single ### Request Body - **EveryTypeKeyProperty** (object) - Required - The EveryTypeKeyProperty object to be created. ### Request Example { "example": "{\n \"keyString\": \"exampleString\",\n \"keyInteger\": 123,\n \"keyLong\": 1234567890,\n \"keyDouble\": 123.45,\n \"keyFloat\": 123.45f,\n \"keyBoolean\": false,\n \"keyInstant\": \"2023-10-27T10:30:00Z\",\n \"keyLocalDate\": \"2023-10-27\",\n \"everyTypeForeignKeyProperties\": {\n \"id\": \"fk_id_1\",\n \"foreignKeyString\": \"fkString\",\n \"foreignKeyInteger\": 456,\n \"foreignKeyLong\": 9876543210,\n \"foreignKeyDouble\": 678.90,\n \"foreignKeyFloat\": 678.90f,\n \"foreignKeyBoolean\": true,\n \"foreignKeyInstant\": \"2023-10-27T11:00:00Z\",\n \"foreignKeyLocalDate\": \"2023-10-27\",\n \"data\": \"fkData\"\n }\n}" } ### Response #### Success Response (200 or 201) - **id** (string) - The unique identifier of the created EveryTypeKeyProperty entity. #### Response Example { "example": "{\"id\": \"generated-id-123\"}" } ``` -------------------------------- ### GET /tag/{name} Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/klass-generator-klass-html-test/src/test/resources/cool/klass/generator/klass/html/test/stackoverflow.klass.html Retrieves a specific tag by name. ```APIDOC ## GET /tag/{name} ### Description Retrieves a tag by its name using the TagProjection. ### Method GET ### Endpoint /tag/{name} ### Parameters #### Path Parameters - **name** (String) - Required - The name of the tag. ``` -------------------------------- ### GET /api/meta/class Source: https://context7.com/liftwizard/klass/llms.txt Retrieves metadata for classes defined in the model. ```APIDOC ## GET /api/meta/class/{className} ### Description Query the bootstrapped metamodel to retrieve class metadata as data. ### Method GET ### Endpoint /api/meta/class/{className} ### Parameters #### Path Parameters - **className** (String) - Optional - The name of the class to retrieve metadata for. If omitted, returns all classes. ### Response #### Success Response (200) - **name** (String) - Class name - **packageName** (String) - Package name - **primitiveProperties** (Array) - List of class properties ``` -------------------------------- ### POST /propertiesOptional Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-klass-html/src/test/resources/cool/klass/xample/coverage/html/coverage-example.klass.html Creates a new PropertiesOptional resource. ```APIDOC ## POST /propertiesOptional ### Description Creates a new instance of the PropertiesOptional resource. ### Method POST ### Endpoint /propertiesOptional ### Request Body - **projection** (PropertiesOptionalCreatedProjection) - Required - The projection used for the creation operation. ``` -------------------------------- ### GET /api/meta/code/element/PropertiesRequiredHasVersion Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-klass-html/src/test/resources/cool/klass/xample/coverage/html/coverage-example.klass:43:4 --> Version association macro.html Retrieves the metadata definition for the PropertiesRequiredHasVersion association. ```APIDOC ## GET /api/meta/code/element/PropertiesRequiredHasVersion ### Description Retrieves the structural definition of the PropertiesRequiredHasVersion association, which links a PropertiesRequired entity to its versioned counterpart. ### Method GET ### Endpoint /api/meta/code/element/PropertiesRequiredHasVersion ### Response #### Success Response (200) - **propertiesRequired** (PropertiesRequired) - The required property entity. - **version** (PropertiesRequiredVersion) - The owned version entity associated with the property. ``` -------------------------------- ### POST /everyTypeKeyProperty/multipleWithProjection Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-dropwizard-application/src/test/resources/cool/klass/xample/coverage/dropwizard/test/cool.klass.xample.coverage.dropwizard.test.SourceCodeResourceTest Creates multiple EveryTypeKeyProperty entities with a specified projection for the response. ```APIDOC ## POST /everyTypeKeyProperty/multipleWithProjection ### Description Creates multiple EveryTypeKeyProperty entities and returns them with a specified projection. ### Method POST ### Endpoint /everyTypeKeyProperty/multipleWithProjection ### Parameters #### Query Parameters - **projection** (string) - Optional - Specifies the projection to be used for the response. Defaults to 'EveryTypeKeyPropertyProjection'. ### Request Body - **EveryTypeKeyProperty[]** (array) - Required - An array of EveryTypeKeyProperty objects to be created. ### Request Example { "example": "[\n {\n \"keyString\": \"exampleString1\",\n \"keyInteger\": 101\n },\n {\n \"keyString\": \"exampleString2\",\n \"keyInteger\": 102\n }\n]" } ### Response #### Success Response (200) - **EveryTypeKeyPropertyProjection[]** (array) - An array of created EveryTypeKeyProperty objects, with the specified projection applied. #### Response Example { "example": "[\n {\n \"keyString\": \"exampleString1\",\n \"keyInteger\": 101,\n \"version\": { \"number\": 1 }\n },\n {\n \"keyString\": \"exampleString2\",\n \"keyInteger\": 102,\n \"version\": { \"number\": 1 }\n }\n]" } ``` -------------------------------- ### Generate Liftwizard Klass Project Source: https://github.com/liftwizard/klass/blob/main/docs/part1/README.md Use this Maven command to generate a new project with the specified group ID, artifact ID, and version. Ensure you are in the parent directory where you want the project to be created. ```bash mvn archetype:generate \ -DarchetypeGroupId=com.klass \ -DarchetypeArtifactId=klass-maven-archetype \ -DinteractiveMode=false \ -DgroupId=com.stackoverflow \ -DartifactId=stackoverflow \ -Dversion=1.0.0 \ -Dpackage=com.stackoverflow \ -Dname=StackOverflow ``` -------------------------------- ### POST /everyTypeKeyProperty/singleWithProjection Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-dropwizard-application/src/test/resources/cool/klass/xample/coverage/dropwizard/test/cool.klass.xample.coverage.dropwizard.test.SourceCodeResourceTest Creates a single EveryTypeKeyProperty entity with a specified projection. ```APIDOC ## POST /everyTypeKeyProperty/singleWithProjection ### Description Creates a single EveryTypeKeyProperty entity and returns it with a specified projection. ### Method POST ### Endpoint /everyTypeKeyProperty/singleWithProjection ### Parameters #### Query Parameters - **projection** (string) - Optional - Specifies the projection to be used for the response. Defaults to 'EveryTypeKeyPropertyProjection'. ### Request Body - **EveryTypeKeyProperty** (object) - Required - The EveryTypeKeyProperty object to be created. ### Request Example { "example": "{\n \"keyString\": \"exampleString\",\n \"keyInteger\": 123,\n \"keyLong\": 1234567890,\n \"keyDouble\": 123.45,\n \"keyFloat\": 123.45f,\n \"keyBoolean\": false,\n \"keyInstant\": \"2023-10-27T10:30:00Z\",\n \"keyLocalDate\": \"2023-10-27\",\n \"everyTypeForeignKeyProperties\": {\n \"id\": \"fk_id_1\",\n \"foreignKeyString\": \"fkString\",\n \"foreignKeyInteger\": 456,\n \"foreignKeyLong\": 9876543210,\n \"foreignKeyDouble\": 678.90,\n \"foreignKeyFloat\": 678.90f,\n \"foreignKeyBoolean\": true,\n \"foreignKeyInstant\": \"2023-10-27T11:00:00Z\",\n \"foreignKeyLocalDate\": \"2023-10-27\",\n \"data\": \"fkData\"\n }\n}" } ### Response #### Success Response (200) - **EveryTypeKeyPropertyProjection** (object) - The created EveryTypeKeyProperty object, with the specified projection applied. #### Response Example { "example": "{\n \"keyString\": \"exampleString\",\n \"keyInteger\": 123,\n \"keyLong\": 1234567890,\n \"keyDouble\": 123.45,\n \"keyFloat\": 123.45f,\n \"keyBoolean\": false,\n \"keyInstant\": \"2023-10-27T10:30:00Z\",\n \"keyLocalDate\": \"2023-10-27\",\n \"everyTypeForeignKeyProperties\": {\n \"id\": \"fk_id_1\",\n \"foreignKeyString\": \"fkString\",\n \"foreignKeyInteger\": 456,\n \"foreignKeyLong\": 9876543210,\n \"foreignKeyDouble\": 678.90,\n \"foreignKeyFloat\": 678.90f,\n \"foreignKeyBoolean\": true,\n \"foreignKeyInstant\": \"2023-10-27T11:00:00Z\",\n \"foreignKeyLocalDate\": \"2023-10-27\",\n \"data\": \"fkData\"\n }\n}" } ``` -------------------------------- ### GET /propertiesRequired/{propertiesRequiredId} Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-klass-html/src/test/resources/cool/klass/xample/coverage/html/coverage-example.klass.html Retrieves a specific PropertiesRequired resource by its ID. ```APIDOC ## GET /propertiesRequired/{propertiesRequiredId} ### Description Retrieves a single PropertiesRequired resource using the provided ID. ### Method GET ### Endpoint /propertiesRequired/{propertiesRequiredId} ### Parameters #### Path Parameters - **propertiesRequiredId** (Long) - Required - The unique identifier of the resource. ``` -------------------------------- ### GET /user/{userId} Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-dropwizard-application/src/test/resources/cool/klass/xample/coverage/dropwizard/test/cool.klass.xample.coverage.dropwizard.test.SourceCodeResourceTest Retrieves a single user by their unique identifier. ```APIDOC ## GET /user/{userId} ### Description Retrieves the details of a specific user based on the provided userId. ### Method GET ### Endpoint /user/{userId} ### Parameters #### Path Parameters - **userId** (String) - Required - The unique identifier of the user. ``` -------------------------------- ### POST /api/meta Source: https://github.com/liftwizard/klass/blob/main/docs/part3/5_dynamic_model.md Creates new projections or services. ```APIDOC ## POST /api/meta ### Description Creates new projections or services. ### Method POST ### Endpoint /api/meta ### Response #### Success Response (200) - **status** (string) - Confirmation of creation. ``` -------------------------------- ### GET /answer/{id} Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/klass-generator-klass-html-test/src/test/resources/cool/klass/generator/klass/html/test/stackoverflow.klass.html Retrieves a single answer by its unique identifier. ```APIDOC ## GET /answer/{id} ### Description Retrieves a single answer by its unique identifier using the AnswerProjection. ### Method GET ### Endpoint /answer/{id} ### Parameters #### Path Parameters - **id** (Long) - Required - The unique identifier of the answer. ``` -------------------------------- ### GET /api/meta/code/element/ClassWithDerivedProperty Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-klass-html/src/test/resources/cool/klass/xample/coverage/html/coverage-example.klass.html Retrieves metadata for the ClassWithDerivedProperty element, including its derived properties. ```APIDOC ## GET /api/meta/code/element/ClassWithDerivedProperty ### Description Retrieves the definition of the ClassWithDerivedProperty element, which contains various derived properties such as LocalDate, String, Integer, Long, Double, Float, Boolean, and Instant types. ### Method GET ### Endpoint /api/meta/code/element/ClassWithDerivedProperty ### Response #### Success Response (200) - **derivedOptionalLocalDate** (LocalDate?) - Derived optional local date property. ``` -------------------------------- ### Query Meta API Source: https://context7.com/liftwizard/klass/llms.txt Retrieves class metadata from the bootstrapped metamodel. ```bash # Get metadata for Question class curl http://localhost:8080/api/meta/class/Question # Get all classes in the model curl http://localhost:8080/api/meta/class ``` ```json { "name": "Question", "packageName": "com.stackoverflow", "abstractClass": false, "classifierModifiers": [ {"name": "systemTemporal"}, {"name": "versioned"}, {"name": "audited"} ], "primitiveProperties": [ { "name": "id", "primitiveType": "Long", "key": true, "id": true }, { "name": "title", "primitiveType": "String", "optional": false } ], "associationEnds": [ { "name": "answers", "multiplicity": "0..*", "resultType": {"name": "Answer"} } ] } ``` -------------------------------- ### GET /properties-required/search-by-name Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-klass-html/src/test/resources/cool/klass/xample/coverage/html/coverage-example.klass.html Searches for PropertiesRequired entities that contain a specific name string. ```APIDOC ## GET /properties-required/search-by-name ### Description Searches for multiple PropertiesRequired entities where the requiredString field contains the provided name. ### Method GET ### Endpoint /properties-required/search-by-name ### Parameters #### Query Parameters - **name** (String) - Required - The string to search for within the requiredString field. ### Response #### Success Response (200) - **List** (Array) - A list of matching PropertiesRequired entities. ``` -------------------------------- ### GET /properties-required/{propertiesRequiredId} Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-klass-html/src/test/resources/cool/klass/xample/coverage/html/coverage-example.klass.html Retrieves a single PropertiesRequired entity by its unique identifier. ```APIDOC ## GET /properties-required/{propertiesRequiredId} ### Description Retrieves a single PropertiesRequired entity based on the provided ID. ### Method GET ### Endpoint /properties-required/{propertiesRequiredId} ### Parameters #### Path Parameters - **propertiesRequiredId** (Long) - Required - The unique identifier of the PropertiesRequired entity. ### Response #### Success Response (200) - **PropertiesRequiredProjection** (Object) - The projected data of the requested entity. ``` -------------------------------- ### GET /api/meta/code/element/ClassWithDerivedProperty/derivedOptionalLocalDate Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-dropwizard-application/src/test/resources/cool/klass/xample/coverage/dropwizard/test/cool.klass.xample.coverage.dropwizard.test.SourceCodeResourceTest Retrieves metadata for the derivedOptionalLocalDate property within the ClassWithDerivedProperty element. ```APIDOC ## GET /api/meta/code/element/ClassWithDerivedProperty/derivedOptionalLocalDate ### Description Retrieves the metadata definition for the derivedOptionalLocalDate property. ### Method GET ### Endpoint /api/meta/code/element/ClassWithDerivedProperty/derivedOptionalLocalDate ``` -------------------------------- ### Implement Temporal Query with Versioning Source: https://context7.com/liftwizard/klass/llms.txt Enables historical data retrieval by adding version and temporal range parameters to service definitions. ```klass service QuestionResource on Question { /question/{id: Long[1..1]}?{version: Integer[0..1] version}&{system: TemporalRange[0..1] system} GET { multiplicity : one; criteria : this.id == id; optionalCriteria: this.version.number == version; optionalCriteria: this.system == system; projection : QuestionReadProjection; format : json; } } ``` -------------------------------- ### POST /api/question Source: https://context7.com/liftwizard/klass/llms.txt Creates a new question resource. ```APIDOC ## POST /api/question ### Description Create a new resource by POSTing to the collection endpoint. ### Method POST ### Endpoint /api/question ### Request Body - **title** (String) - Required - The title of the question - **body** (String) - Required - The body content of the question ### Response #### Success Response (201) - **Location** (Header) - URL of the created resource ``` -------------------------------- ### GET /question/{questionId}/answers Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/klass-generator-klass-html-test/src/test/resources/cool/klass/generator/klass/html/test/stackoverflow.klass.html Retrieves all answers associated with a specific question. ```APIDOC ## GET /question/{questionId}/answers ### Description Retrieves a list of answers associated with the provided question ID using the AnswerProjection. ### Method GET ### Endpoint /question/{questionId}/answers ### Parameters #### Path Parameters - **questionId** (Long) - Required - The unique identifier of the question. ``` -------------------------------- ### GET /api/meta/code/element/PropertiesOptionalVersionHasCreatedBy Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/coverage-example-klass-html/src/test/resources/cool/klass/xample/coverage/html/coverage-example.klass:155:4 --> Version class macro:3:47 --> Audit association macro.html Retrieves the meta-model definition for the association between PropertiesOptionalVersion and the User who created it. ```APIDOC ## GET /api/meta/code/element/PropertiesOptionalVersionHasCreatedBy ### Description Retrieves the association definition for PropertiesOptionalVersionHasCreatedBy, linking a version to its creator. ### Method GET ### Endpoint /api/meta/code/element/PropertiesOptionalVersionHasCreatedBy ``` -------------------------------- ### POST /question Source: https://github.com/liftwizard/klass/blob/main/xample-projects/coverage-example/klass-generator-klass-html-test/src/test/resources/cool/klass/generator/klass/html/test/stackoverflow.klass.html Creates a new question with a one-to-one multiplicity. ```APIDOC ## POST /question ### Description Creates a new question with a one-to-one multiplicity. ### Method POST ### Endpoint /question ### Request Body - **multiplicity** (string) - Required - Must be 'one'. ### Request Example { "multiplicity": "one" } ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example { "message": "Question created successfully." } ```