added models generator
This commit is contained in:
parent
7a9280790f
commit
01249f5b54
57
examples/de/nclazz/users/v0/models/Role.java
Normal file
57
examples/de/nclazz/users/v0/models/Role.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* Auto-generated from apibuilder.io service specification.
|
||||
* apidoc-version : 0.15.4
|
||||
* organisation : nclazz
|
||||
* service-version : 0.0.0-dev-30-gbd50cdf-bd9390b2-staging
|
||||
*
|
||||
* Documentation at:
|
||||
* <a href="https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging">https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging</a>
|
||||
*
|
||||
**/
|
||||
package ;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.With;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NotNull;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.time.LocalDateTime;
|
||||
import de.nclazz.users.v0.models.UserStatus;
|
||||
|
||||
/**
|
||||
*
|
||||
* See <a href="https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging#model-">https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging#model-</a>
|
||||
*
|
||||
**/
|
||||
@With
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
@Builder(toBuilder = true)
|
||||
@NoArgsConstructor
|
||||
public class Role {
|
||||
|
||||
/** Role assigned to a user. **/
|
||||
@NotNull
|
||||
private UUID id;
|
||||
|
||||
/** Role assigned to a user. **/
|
||||
@NotNull
|
||||
private String name;
|
||||
|
||||
/** Role assigned to a user. **/
|
||||
@NotNull
|
||||
private LocalDateTime created;
|
||||
|
||||
/** Role assigned to a user. **/
|
||||
@NotNull
|
||||
private LocalDateTime updated;
|
||||
|
||||
/** Role assigned to a user. **/
|
||||
@NotNull
|
||||
private UserStatus status;
|
||||
|
||||
|
||||
}
|
38
examples/de/nclazz/users/v0/models/RoleForm.java
Normal file
38
examples/de/nclazz/users/v0/models/RoleForm.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* Auto-generated from apibuilder.io service specification.
|
||||
* apidoc-version : 0.15.4
|
||||
* organisation : nclazz
|
||||
* service-version : 0.0.0-dev-30-gbd50cdf-bd9390b2-staging
|
||||
*
|
||||
* Documentation at:
|
||||
* <a href="https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging">https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging</a>
|
||||
*
|
||||
**/
|
||||
package ;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.With;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* See <a href="https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging#model-">https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging#model-</a>
|
||||
*
|
||||
**/
|
||||
@With
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
@Builder(toBuilder = true)
|
||||
@NoArgsConstructor
|
||||
public class RoleForm {
|
||||
|
||||
/** Form for creating and updating a new user role. **/
|
||||
@NotNull
|
||||
private String name;
|
||||
|
||||
|
||||
}
|
57
examples/de/nclazz/users/v0/models/User.java
Normal file
57
examples/de/nclazz/users/v0/models/User.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* Auto-generated from apibuilder.io service specification.
|
||||
* apidoc-version : 0.15.4
|
||||
* organisation : nclazz
|
||||
* service-version : 0.0.0-dev-30-gbd50cdf-bd9390b2-staging
|
||||
*
|
||||
* Documentation at:
|
||||
* <a href="https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging">https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging</a>
|
||||
*
|
||||
**/
|
||||
package ;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.With;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NotNull;
|
||||
|
||||
import de.nclazz.users.v0.models.UserStatus;
|
||||
import de.nclazz.users.v0.models.Role;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* See <a href="https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging#model-">https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging#model-</a>
|
||||
*
|
||||
**/
|
||||
@With
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
@Builder(toBuilder = true)
|
||||
@NoArgsConstructor
|
||||
public class User {
|
||||
|
||||
/** ID of the user as a 32 char long hex string. **/
|
||||
@NotNull
|
||||
private String id;
|
||||
|
||||
/** Name of the user, which can be the email address. **/
|
||||
@NotNull
|
||||
private String name;
|
||||
|
||||
/** Email of the user. **/
|
||||
@NotNull
|
||||
private String email;
|
||||
|
||||
/** Status of the user as described in the user_status enum. **/
|
||||
@NotNull
|
||||
private UserStatus status;
|
||||
|
||||
/** Roles assigned to the user. **/
|
||||
@NotNull
|
||||
private List<Role> roles;
|
||||
|
||||
|
||||
}
|
42
examples/de/nclazz/users/v0/models/UserForm.java
Normal file
42
examples/de/nclazz/users/v0/models/UserForm.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* Auto-generated from apibuilder.io service specification.
|
||||
* apidoc-version : 0.15.4
|
||||
* organisation : nclazz
|
||||
* service-version : 0.0.0-dev-30-gbd50cdf-bd9390b2-staging
|
||||
*
|
||||
* Documentation at:
|
||||
* <a href="https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging">https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging</a>
|
||||
*
|
||||
**/
|
||||
package ;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.With;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* See <a href="https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging#model-">https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging#model-</a>
|
||||
*
|
||||
**/
|
||||
@With
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
@Builder(toBuilder = true)
|
||||
@NoArgsConstructor
|
||||
public class UserForm {
|
||||
|
||||
/** Name of the user to be created. **/
|
||||
@NotNull
|
||||
private String name;
|
||||
|
||||
/** Email of the user to be created. **/
|
||||
@NotNull
|
||||
private String email;
|
||||
|
||||
|
||||
}
|
47
examples/de/nclazz/users/v0/models/UserLogin.java
Normal file
47
examples/de/nclazz/users/v0/models/UserLogin.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* Auto-generated from apibuilder.io service specification.
|
||||
* apidoc-version : 0.15.4
|
||||
* organisation : nclazz
|
||||
* service-version : 0.0.0-dev-30-gbd50cdf-bd9390b2-staging
|
||||
*
|
||||
* Documentation at:
|
||||
* <a href="https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging">https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging</a>
|
||||
*
|
||||
**/
|
||||
package ;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.With;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NotNull;
|
||||
|
||||
import de.nclazz.users.v0.models.User;
|
||||
|
||||
/**
|
||||
*
|
||||
* See <a href="https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging#model-">https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging#model-</a>
|
||||
*
|
||||
**/
|
||||
@With
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
@Builder(toBuilder = true)
|
||||
@NoArgsConstructor
|
||||
public class UserLogin {
|
||||
|
||||
/** Information and Tokens for the logged in user for authentication. **/
|
||||
@NotNull
|
||||
private User user;
|
||||
|
||||
/** Information and Tokens for the logged in user for authentication. **/
|
||||
@NotNull
|
||||
private String token;
|
||||
|
||||
/** Information and Tokens for the logged in user for authentication. **/
|
||||
@NotNull
|
||||
private String refreshToken;
|
||||
|
||||
|
||||
}
|
42
examples/de/nclazz/users/v0/models/UserLoginForm.java
Normal file
42
examples/de/nclazz/users/v0/models/UserLoginForm.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* Auto-generated from apibuilder.io service specification.
|
||||
* apidoc-version : 0.15.4
|
||||
* organisation : nclazz
|
||||
* service-version : 0.0.0-dev-30-gbd50cdf-bd9390b2-staging
|
||||
*
|
||||
* Documentation at:
|
||||
* <a href="https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging">https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging</a>
|
||||
*
|
||||
**/
|
||||
package ;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.With;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* See <a href="https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging#model-">https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging#model-</a>
|
||||
*
|
||||
**/
|
||||
@With
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
@Builder(toBuilder = true)
|
||||
@NoArgsConstructor
|
||||
public class UserLoginForm {
|
||||
|
||||
/** Login Form for username:password authentication. **/
|
||||
@NotNull
|
||||
private String username;
|
||||
|
||||
/** Login Form for username:password authentication. **/
|
||||
@NotNull
|
||||
private String password;
|
||||
|
||||
|
||||
}
|
47
examples/de/nclazz/users/v0/models/UserStatus.java
Normal file
47
examples/de/nclazz/users/v0/models/UserStatus.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* Auto-generated from apibuilder.io service spec.
|
||||
* apidoc-version : 0.15.4
|
||||
* organisation : nclazz
|
||||
*
|
||||
* Documentation at:
|
||||
* <a href="https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging">https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging</a>
|
||||
*
|
||||
**/
|
||||
package de.nclazz.users.v0.models;
|
||||
|
||||
public enum UserStatus {
|
||||
|
||||
/** User is active and has access to the system. **/
|
||||
ACTIVE("active"),
|
||||
|
||||
/** User is not active and has no access to the system. **/
|
||||
INACTIVE("inactive"),
|
||||
|
||||
/** User is created but not has not yet access to the system. **/
|
||||
CREATED("created"),
|
||||
|
||||
/** User is deleted and can not access the system. Deleted user will stay in the system for a while, before completely removed. **/
|
||||
DELETED("deleted");
|
||||
|
||||
|
||||
|
||||
private final String value;
|
||||
|
||||
UserStatus(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public static UserStatus forValue(String value) {
|
||||
for(UserStatus userStatus : UserStatus.values()) {
|
||||
if(userStatus.value.equals(value)) {
|
||||
return userStatus;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("UserStatus '" + value + "' does not exist!");
|
||||
}
|
||||
|
||||
}
|
39
examples/de/nclazz/users/v0/models/UserStatusForm.java
Normal file
39
examples/de/nclazz/users/v0/models/UserStatusForm.java
Normal file
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
* Auto-generated from apibuilder.io service specification.
|
||||
* apidoc-version : 0.15.4
|
||||
* organisation : nclazz
|
||||
* service-version : 0.0.0-dev-30-gbd50cdf-bd9390b2-staging
|
||||
*
|
||||
* Documentation at:
|
||||
* <a href="https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging">https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging</a>
|
||||
*
|
||||
**/
|
||||
package ;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.With;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NotNull;
|
||||
|
||||
import de.nclazz.users.v0.models.UserStatus;
|
||||
|
||||
/**
|
||||
*
|
||||
* See <a href="https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging#model-">https://app.apibuilder.io/nclazz/users/0.0.0-dev-30-gbd50cdf-bd9390b2-staging#model-</a>
|
||||
*
|
||||
**/
|
||||
@With
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
@Builder(toBuilder = true)
|
||||
@NoArgsConstructor
|
||||
public class UserStatusForm {
|
||||
|
||||
/** Form for updating the status of a user. **/
|
||||
@NotNull
|
||||
private UserStatus status;
|
||||
|
||||
|
||||
}
|
944
examples/example.json
Normal file
944
examples/example.json
Normal file
|
@ -0,0 +1,944 @@
|
|||
{
|
||||
"apidoc": {
|
||||
"version": "0.15.4"
|
||||
},
|
||||
"name": "users",
|
||||
"organization": {
|
||||
"key": "nclazz"
|
||||
},
|
||||
"application": {
|
||||
"key": "users"
|
||||
},
|
||||
"namespace": "de.nclazz.users.v0",
|
||||
"version": "0.0.0-dev-30-gbd50cdf-bd9390b2-staging",
|
||||
"info": {
|
||||
"contact": {
|
||||
"name": "Niclas Thobaben",
|
||||
"url": "https://nclazz.de",
|
||||
"email": "info@nclazz.de"
|
||||
}
|
||||
},
|
||||
"headers": [],
|
||||
"imports": [
|
||||
{
|
||||
"uri": "https://app.apibuilder.io/nclazz/common/latest/service.json",
|
||||
"namespace": "de.nclazz.common.v0",
|
||||
"organization": {
|
||||
"key": "nclazz"
|
||||
},
|
||||
"application": {
|
||||
"key": "common"
|
||||
},
|
||||
"version": "0.0.0-dev",
|
||||
"enums": [],
|
||||
"interfaces": [],
|
||||
"unions": [],
|
||||
"models": [
|
||||
"genericError",
|
||||
"healthcheck"
|
||||
],
|
||||
"annotations": [
|
||||
{
|
||||
"name": "personal_data",
|
||||
"description": "Identifies a field that contains Personal Data, as defined by GDPR."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"uri": "https://app.apibuilder.io/nclazz/errors/latest/service.json",
|
||||
"namespace": "de.nclazz.errors.v0",
|
||||
"organization": {
|
||||
"key": "nclazz"
|
||||
},
|
||||
"application": {
|
||||
"key": "errors"
|
||||
},
|
||||
"version": "0.0.0-dev-24-g9ca2bf7-bd9390b2-staging",
|
||||
"enums": [],
|
||||
"interfaces": [
|
||||
"error"
|
||||
],
|
||||
"unions": [],
|
||||
"models": [
|
||||
"genericError"
|
||||
],
|
||||
"annotations": [
|
||||
{
|
||||
"name": "personal_data",
|
||||
"description": "Identifies a field that contains Personal Data, as defined by GDPR."
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"enums": [
|
||||
{
|
||||
"name": "userStatus",
|
||||
"plural": "userStatuses",
|
||||
"values": [
|
||||
{
|
||||
"name": "active",
|
||||
"attributes": [],
|
||||
"description": "User is active and has access to the system."
|
||||
},
|
||||
{
|
||||
"name": "inactive",
|
||||
"attributes": [],
|
||||
"description": "User is not active and has no access to the system."
|
||||
},
|
||||
{
|
||||
"name": "created",
|
||||
"attributes": [],
|
||||
"description": "User is created but not has not yet access to the system."
|
||||
},
|
||||
{
|
||||
"name": "deleted",
|
||||
"attributes": [],
|
||||
"description": "User is deleted and can not access the system. Deleted user will stay in the system for a while, before completely removed."
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"description": "Status of a given user or user role."
|
||||
}
|
||||
],
|
||||
"interfaces": [],
|
||||
"unions": [],
|
||||
"models": [
|
||||
{
|
||||
"name": "role",
|
||||
"plural": "roles",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "uuid",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": [],
|
||||
"minimum": 4,
|
||||
"maximum": 64
|
||||
},
|
||||
{
|
||||
"name": "created",
|
||||
"type": "date-time-iso8601",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": []
|
||||
},
|
||||
{
|
||||
"name": "updated",
|
||||
"type": "date-time-iso8601",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": []
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "userStatus",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"interfaces": [],
|
||||
"description": "Role assigned to a user."
|
||||
},
|
||||
{
|
||||
"name": "role_form",
|
||||
"plural": "role_forms",
|
||||
"fields": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"interfaces": [],
|
||||
"description": "Form for creating and updating a new user role."
|
||||
},
|
||||
{
|
||||
"name": "user",
|
||||
"plural": "users",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": [],
|
||||
"description": "ID of the user as a 32 char long hex string.",
|
||||
"minimum": 32,
|
||||
"maximum": 32
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": [],
|
||||
"description": "Name of the user, which can be the email address.",
|
||||
"minimum": 8,
|
||||
"maximum": 32
|
||||
},
|
||||
{
|
||||
"name": "email",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": [
|
||||
"personal_data"
|
||||
],
|
||||
"description": "Email of the user.",
|
||||
"minimum": 4,
|
||||
"maximum": 64
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "userStatus",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": [],
|
||||
"description": "Status of the user as described in the user_status enum."
|
||||
},
|
||||
{
|
||||
"name": "roles",
|
||||
"type": "[role]",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": [],
|
||||
"description": "Roles assigned to the user."
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"interfaces": [],
|
||||
"description": "A user defined by an id and an username."
|
||||
},
|
||||
{
|
||||
"name": "user_form",
|
||||
"plural": "user_forms",
|
||||
"fields": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": [],
|
||||
"description": "Name of the user to be created.",
|
||||
"minimum": 8,
|
||||
"maximum": 32
|
||||
},
|
||||
{
|
||||
"name": "email",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": [],
|
||||
"description": "Email of the user to be created.",
|
||||
"minimum": 4,
|
||||
"maximum": 64
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"interfaces": [],
|
||||
"description": "Form for creating and updating a new user."
|
||||
},
|
||||
{
|
||||
"name": "userLogin",
|
||||
"plural": "userLogins",
|
||||
"fields": [
|
||||
{
|
||||
"name": "user",
|
||||
"type": "user",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": []
|
||||
},
|
||||
{
|
||||
"name": "token",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": [],
|
||||
"minimum": 64,
|
||||
"maximum": 64
|
||||
},
|
||||
{
|
||||
"name": "refreshToken",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": [],
|
||||
"minimum": 64,
|
||||
"maximum": 64
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"interfaces": [],
|
||||
"description": "Information and Tokens for the logged in user for authentication."
|
||||
},
|
||||
{
|
||||
"name": "userLogin_form",
|
||||
"plural": "userLogin_forms",
|
||||
"fields": [
|
||||
{
|
||||
"name": "username",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": [],
|
||||
"minimum": 8,
|
||||
"maximum": 32
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": [],
|
||||
"minimum": 8,
|
||||
"maximum": 64
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"interfaces": [],
|
||||
"description": "Login Form for username:password authentication."
|
||||
},
|
||||
{
|
||||
"name": "userStatus_form",
|
||||
"plural": "userStatus_forms",
|
||||
"fields": [
|
||||
{
|
||||
"name": "status",
|
||||
"type": "userStatus",
|
||||
"required": true,
|
||||
"attributes": [],
|
||||
"annotations": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"interfaces": [],
|
||||
"description": "Form for updating the status of a user."
|
||||
}
|
||||
],
|
||||
"resources": [
|
||||
{
|
||||
"type": "de.nclazz.common.v0.models.healthcheck",
|
||||
"plural": "healthchecks",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/_internal_/healthcheck/healthcheck",
|
||||
"parameters": [],
|
||||
"responses": [
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 200
|
||||
}
|
||||
},
|
||||
"type": "de.nclazz.common.v0.models.healthcheck",
|
||||
"description": "Get the current health status of the service.",
|
||||
"attributes": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"description": "Simple healthcheck endpoint to test the status of the service."
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"path": "/_internal_/healthcheck",
|
||||
"description": "Simple healthcheck resource for monitoring purposes."
|
||||
},
|
||||
{
|
||||
"type": "role",
|
||||
"plural": "roles",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/roles/",
|
||||
"parameters": [],
|
||||
"responses": [
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 200
|
||||
}
|
||||
},
|
||||
"type": "[role]",
|
||||
"description": "OK.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 401
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Unauthorized.",
|
||||
"attributes": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"description": "Get all defined user roles."
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/roles/:id/:other",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "uuid",
|
||||
"location": "Path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "other",
|
||||
"type": "string",
|
||||
"location": "Path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": [
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 200
|
||||
}
|
||||
},
|
||||
"type": "role",
|
||||
"description": "User role found.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 401
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Unauthorized",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 404
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "User role not found.",
|
||||
"attributes": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"description": "Get a user role for id."
|
||||
},
|
||||
{
|
||||
"method": "POST",
|
||||
"path": "/roles/",
|
||||
"parameters": [],
|
||||
"responses": [
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 201
|
||||
}
|
||||
},
|
||||
"type": "user",
|
||||
"description": "User role successfully created.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 400
|
||||
}
|
||||
},
|
||||
"type": "[de.nclazz.errors.v0.models.genericError]",
|
||||
"description": "Bad Request.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 401
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Unauthorized.",
|
||||
"attributes": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"description": "Create a new user role.",
|
||||
"body": {
|
||||
"type": "role_form",
|
||||
"attributes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "PUT",
|
||||
"path": "/roles/:id/status",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "uuid",
|
||||
"location": "Path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": [
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 200
|
||||
}
|
||||
},
|
||||
"type": "userStatus",
|
||||
"description": "User role status updated successfully.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 400
|
||||
}
|
||||
},
|
||||
"type": "[de.nclazz.errors.v0.models.genericError]",
|
||||
"description": "Bad Request.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 401
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Unauthorized.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 404
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Not Found.",
|
||||
"attributes": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"description": "Update the status of a user role.",
|
||||
"body": {
|
||||
"type": "userStatus_form",
|
||||
"attributes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "DELETE",
|
||||
"path": "/roles/:id",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "uuid",
|
||||
"location": "Path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": [
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 200
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "User role deleted successfully.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 401
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Unauthorized.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 404
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Not Found.",
|
||||
"attributes": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"description": "Mark a user role as deleted. The user role cannot be accessed by the api, but will stay in the db for a while, before completely removed."
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"path": "/roles",
|
||||
"description": "Managing user roles."
|
||||
},
|
||||
{
|
||||
"type": "user",
|
||||
"plural": "users",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/users/",
|
||||
"parameters": [],
|
||||
"responses": [
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 200
|
||||
}
|
||||
},
|
||||
"type": "[user]",
|
||||
"description": "Users found.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 401
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Unauthorized.",
|
||||
"attributes": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"description": "Get all users."
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/users/:id",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "string",
|
||||
"location": "Path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": [
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 200
|
||||
}
|
||||
},
|
||||
"type": "user",
|
||||
"description": "User found.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 404
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Not found.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 401
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Unauthorized.",
|
||||
"attributes": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"description": "Get a user for given id."
|
||||
},
|
||||
{
|
||||
"method": "POST",
|
||||
"path": "/users/",
|
||||
"parameters": [],
|
||||
"responses": [
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 201
|
||||
}
|
||||
},
|
||||
"type": "user",
|
||||
"description": "User successfully created.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 400
|
||||
}
|
||||
},
|
||||
"type": "[de.nclazz.errors.v0.models.genericError]",
|
||||
"description": "Bad Request.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 401
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Unauthorized.",
|
||||
"attributes": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"description": "Create a new user.",
|
||||
"body": {
|
||||
"type": "user_form",
|
||||
"attributes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "PUT",
|
||||
"path": "/users/:id",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "string",
|
||||
"location": "Path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": [
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 200
|
||||
}
|
||||
},
|
||||
"type": "user",
|
||||
"description": "User updated successfully.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 400
|
||||
}
|
||||
},
|
||||
"type": "[de.nclazz.errors.v0.models.genericError]",
|
||||
"description": "Bad Request.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 401
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Unauthorized.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 404
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Not Found.",
|
||||
"attributes": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"description": "Update user data.",
|
||||
"body": {
|
||||
"type": "user_form",
|
||||
"attributes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "PUT",
|
||||
"path": "/users/:id/status",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "string",
|
||||
"location": "Path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": [
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 200
|
||||
}
|
||||
},
|
||||
"type": "userStatus",
|
||||
"description": "User status updated successfully.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 400
|
||||
}
|
||||
},
|
||||
"type": "[de.nclazz.errors.v0.models.genericError]",
|
||||
"description": "Bad Request.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 401
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Unauthorized.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 404
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Not Found.",
|
||||
"attributes": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"description": "Update the status of the user.",
|
||||
"body": {
|
||||
"type": "userStatus_form",
|
||||
"attributes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "DELETE",
|
||||
"path": "/users/:id",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "string",
|
||||
"location": "Path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": [
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 200
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "User deleted successfully.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 401
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Unauthorized.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 404
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Not Found.",
|
||||
"attributes": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"description": "Mark a user as deleted. The user cannot be accessed by the api, but will stay in the db for a while, before completely removed."
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"path": "/users",
|
||||
"description": "Access to the user management."
|
||||
},
|
||||
{
|
||||
"type": "userLogin",
|
||||
"plural": "userLogins",
|
||||
"operations": [
|
||||
{
|
||||
"method": "POST",
|
||||
"path": "/login/",
|
||||
"parameters": [],
|
||||
"responses": [
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 200
|
||||
}
|
||||
},
|
||||
"type": "userLogin",
|
||||
"description": "User authenticated successfully.",
|
||||
"attributes": []
|
||||
},
|
||||
{
|
||||
"code": {
|
||||
"integer": {
|
||||
"value": 401
|
||||
}
|
||||
},
|
||||
"type": "unit",
|
||||
"description": "Unauthorized.",
|
||||
"attributes": []
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"description": "Login user with username + password.",
|
||||
"body": {
|
||||
"type": "userLogin_form",
|
||||
"attributes": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"path": "/login",
|
||||
"description": "Resource for authenticating users."
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"annotations": [
|
||||
{
|
||||
"name": "personal_data",
|
||||
"description": "Identifies a field that contains Personal Data, as defined by GDPR."
|
||||
}
|
||||
],
|
||||
"description": "Service for user management and authentication."
|
||||
}
|
5
package-lock.json
generated
5
package-lock.json
generated
|
@ -8,6 +8,11 @@
|
|||
"version": "6.2.0",
|
||||
"resolved": "https://nexus.nclazz.de/repository/npm_public/camelcase/-/camelcase-6.2.0.tgz",
|
||||
"integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg=="
|
||||
},
|
||||
"mustache": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://nexus.nclazz.de/repository/npm_public/mustache/-/mustache-4.2.0.tgz",
|
||||
"integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,14 @@
|
|||
"name": "java-apibuilder-generator",
|
||||
"version": "1.0.0",
|
||||
"description": "Java Generators for apibuilder.io service specs.",
|
||||
"main": "index.js",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Niclas Thobaben",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"camelcase": "^6.2.0"
|
||||
"camelcase": "^6.2.0",
|
||||
"mustache": "^4.2.0"
|
||||
}
|
||||
}
|
||||
|
|
36
src/generators/java-models-generator.js
Normal file
36
src/generators/java-models-generator.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
const javaModels = require('../java-model')
|
||||
const Mustache = require('Mustache')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
|
||||
|
||||
const templateModel = fs.readFileSync(path.resolve(path.join('templates', 'lombok-model.java.mustache')), 'utf-8')
|
||||
const templateEnum = fs.readFileSync(path.resolve(path.join('templates', 'lombok-enum.java.mustache')), 'utf-8')
|
||||
|
||||
module.exports = (service) => {
|
||||
|
||||
const models = javaModels.mapJavaModels(service.models, service.namespace)
|
||||
const enums = javaModels.mapJavaEnums(service.enums, service.namespace)
|
||||
|
||||
const modelFiles = models.map(model => {
|
||||
return {
|
||||
name: `${model.name}.java`,
|
||||
dir: model.dir,
|
||||
contents: Mustache.render(templateModel, { service, ...model })
|
||||
}
|
||||
})
|
||||
const enumFiles = enums.map(e => {
|
||||
return {
|
||||
name: `${e.name}.java`,
|
||||
dir: e.dir,
|
||||
contents: Mustache.render(templateEnum, { service, ...e })
|
||||
}
|
||||
})
|
||||
return [
|
||||
...modelFiles,
|
||||
...enumFiles
|
||||
]
|
||||
|
||||
|
||||
}
|
22
src/index.js
Normal file
22
src/index.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
const util = require('util')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const modelGen = require('./generators/java-models-generator')
|
||||
|
||||
|
||||
|
||||
const service = require('../examples/example.json')
|
||||
const models = modelGen(service)
|
||||
|
||||
// console.log(util.inspect(models, { depth: 8 }))
|
||||
|
||||
const out = 'examples'
|
||||
|
||||
models.forEach(file => {
|
||||
let outPath = path.join(out, file.dir)
|
||||
if(!fs.existsSync(outPath)) {
|
||||
fs.mkdirSync(outPath, { recursive: true })
|
||||
}
|
||||
outPath = path.join(outPath, file.name)
|
||||
fs.writeFileSync(outPath, file.contents)
|
||||
})
|
|
@ -7,6 +7,7 @@ module.exports = {
|
|||
return models.map(model => {
|
||||
model.name = utils.pascalcase(model.name)
|
||||
model.package = `${namespace}.models`;
|
||||
model.dir = model.package.replace(/\./g, '/')
|
||||
model.fields = model.fields.map(field => {
|
||||
field.name = utils.camelcase(field.name)
|
||||
field.type = javaType.mapJavaType(field.type, namespace)
|
||||
|
@ -28,8 +29,10 @@ module.exports = {
|
|||
mapJavaEnums: (enums, namespace) => {
|
||||
return enums.map(e => {
|
||||
e['values'][ e['values'].length - 1 ].last = true;
|
||||
e.paramName = e.name
|
||||
e.name = utils.pascalcase(e.name)
|
||||
e.package = `${namespace}.models`
|
||||
e.dir = e.package.replace(/\./g, '/')
|
||||
e.values = e.values.map(value => {
|
||||
value.value = value.value || value.name
|
||||
value.name = value.name.toUpperCase()
|
||||
|
|
40
templates/lombok-enum.java.mustache
Normal file
40
templates/lombok-enum.java.mustache
Normal file
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* Auto-generated from apibuilder.io service spec.
|
||||
* apidoc-version : {{service.apidoc.version}}
|
||||
* organisation : {{service.organization.key}}
|
||||
*
|
||||
* Documentation at:
|
||||
* <a href="https://app.apibuilder.io/{{service.organization.key}}/{{service.name}}/{{service.version}}">https://app.apibuilder.io/{{service.organization.key}}/{{service.name}}/{{service.version}}</a>
|
||||
*
|
||||
**/
|
||||
package {{package}};
|
||||
|
||||
public enum {{name}} {
|
||||
|
||||
{{#values}}
|
||||
{{#description}}/** {{.}} **/{{/description}}
|
||||
{{name}}("{{value}}"){{#last}}; {{/last}}{{^last}}, {{/last}}
|
||||
|
||||
{{/values}}
|
||||
|
||||
|
||||
private final String value;
|
||||
|
||||
{{name}}(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public static {{name}} forValue(String value) {
|
||||
for({{name}} {{paramName}} : {{name}}.values()) {
|
||||
if({{paramName}}.value.equals(value)) {
|
||||
return {{paramName}};
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("{{name}} '" + value + "' does not exist!");
|
||||
}
|
||||
|
||||
}
|
43
templates/lombok-model.java.mustache
Normal file
43
templates/lombok-model.java.mustache
Normal file
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* Auto-generated from apibuilder.io service specification.
|
||||
* apidoc-version : {{service.apidoc.version}}
|
||||
* organisation : {{service.organization.key}}
|
||||
* service-version : {{service.version}}
|
||||
*
|
||||
* Documentation at:
|
||||
* <a href="https://app.apibuilder.io/{{service.organization.key}}/{{service.name}}/{{service.version}}">https://app.apibuilder.io/{{service.organization.key}}/{{service.name}}/{{service.version}}</a>
|
||||
*
|
||||
**/
|
||||
package {{model.package}};
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.With;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NotNull;
|
||||
|
||||
{{#imports}}
|
||||
import {{{.}}};
|
||||
{{/imports}}
|
||||
|
||||
/**
|
||||
* {{model.description}}
|
||||
* See <a href="https://app.apibuilder.io/{{service.organization.key}}/{{service.name}}/{{service.version}}#model-{{model.name}}">https://app.apibuilder.io/{{service.organization.key}}/{{service.name}}/{{service.version}}#model-{{model.name}}</a>
|
||||
*
|
||||
**/
|
||||
@With
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
@Builder(toBuilder = true)
|
||||
@NoArgsConstructor
|
||||
public class {{name}} {
|
||||
|
||||
{{#fields}}
|
||||
{{#description}}/** {{.}} **/{{/description}}
|
||||
{{#required}}@NotNull{{/required}}
|
||||
private {{{type.name}}} {{name}};
|
||||
|
||||
{{/fields}}
|
||||
|
||||
}
|
Loading…
Reference in a new issue