Skip to content

Add swagger annotations #125

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

Merged
merged 1 commit into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,17 @@
<version>${quarkus.version}</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.4</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public interface Catalog {
new IllegalStateException("No se pudo convertir el valor del catálogo");

/**
* @param <T> Class you want to search for
* @param <T> Class you want to search for
* @param enumType class you want to search for
* @param code the code or Enum value
* @param code the code or Enum value
* @return an instance of Catalog which is equal to ValueOf or contains the same code
*/
static <T extends Catalog> Optional<T> valueOfCode(Class<T> enumType, String code) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package io.github.project.openubl.xbuilder.content.models.common;

import io.github.project.openubl.xbuilder.content.catalogs.Catalog6;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -40,18 +41,21 @@ public class Cliente {
* <p>
* Valores válidos: {@link Catalog6}
*/
@Schema(description = "Catalogo 06", required = true)
private String tipoDocumentoIdentidad;

/**
* Número de documento de identidad del cliente.
*/
@Schema(required = true)
private String numeroDocumentoIdentidad;

/**
* Nombre del cliente. Si el cliente es personal natural entonces
* es el nombre y apellidos de la persona; si el cliente es una persona jurídica
* entonces es la razón social de la empresa.
*/
@Schema(required = true)
private String nombre;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package io.github.project.openubl.xbuilder.content.models.common;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -35,10 +36,12 @@ public class Contacto {
/**
* Número telefónico
*/
@Schema(description = "Número telefónico")
private String telefono;

/**
* Correo electrónico
*/
@Schema(description = "Correo electrónico")
private String email;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package io.github.project.openubl.xbuilder.content.models.common;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -35,6 +36,12 @@ public class Direccion {
/**
* Código de 6 dígitos que corresponden al Departamento, Provincia, y Distrito
*/
@Schema(
description = "Código de 6 dígitos que corresponden al Departamento, Provincia, y Distrito",
minLength = 6,
maxLength = 6,
pattern = "[0-9]+"
)
private String ubigeo;

/**
Expand All @@ -43,35 +50,51 @@ public class Direccion {
* establecimiento. Tratándose del domicilio fiscal y en el caso de no poder determinar el lugar
* de la venta, informar “0000”.
*/
@Schema(
description = "Código de cuatro dígitos asignado por SUNAT, que identifica al establecimiento anexo. Dicho código se genera al momento la respectiva comunicación del establecimiento. Tratándose del domicilio fiscal y en el caso de no poder determinar el lugar de la venta, informar \"0000\"",
minLength = 4,
maxLength = 4,
pattern = "[0-9]+"
)
private String codigoLocal;

/**
* Nombre de la urbanización.
*/
@Schema(description = "Nombre de la urbanización.")
private String urbanizacion;

/**
* Nombre del Departamento o Región. Ejemplo: Ayacucho
*/
@Schema(description = "Nombre del Departamento o Región. Ejemplo: Ayacucho")
private String departamento;

/**
* Nombre de la Provincia. Ejemplo: Huamanga
*/
@Schema(description = "Nombre de la Provincia. Ejemplo: Huamanga")
private String provincia;

/**
* Nombre del Distrito. Ejemplo: Quinua
*/
@Schema(description = "Nombre del Distrito. Ejemplo: Quinua")
private String distrito;

/**
* Dirección. Ejemplo: Jirón las piedras 123
*/
@Schema(description = "Dirección. Ejemplo: Jirón las piedras 123")
private String direccion;

/**
* Código de 2 dígitos que corresponde al país a la que pertenece la dirección. Ejemplo: PE
*/
@Schema(
description = "Código de 2 dígitos que corresponde al país a la que pertenece la dirección. Ejemplo: PE",
minLength = 2,
maxLength = 2
)
private String codigoPais;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package io.github.project.openubl.xbuilder.content.models.common;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -35,10 +36,12 @@ public class Firmante {
/**
* Número de RUC de la persona
*/
@Schema(required = true, minLength = 11, maxLength = 11, pattern = "[0-9]+")
private String ruc;

/**
* Razón social de la persona
*/
@Schema(required = true)
private String razonSocial;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package io.github.project.openubl.xbuilder.content.models.common;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -35,6 +36,7 @@ public class Proveedor {
/**
* Número de RUC de la persona jurídica
*/
@Schema(required = true, minLength = 11, maxLength = 11, pattern = "[0-9]+")
private String ruc;

/**
Expand All @@ -45,6 +47,7 @@ public class Proveedor {
/**
* Razón social de la persona jurídica
*/
@Schema(required = true)
private String razonSocial;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package io.github.project.openubl.xbuilder.content.models.standard.general;

import io.github.project.openubl.xbuilder.content.catalogs.Catalog53_Anticipo;
import io.swagger.v3.oas.annotations.media.Schema;
import java.math.BigDecimal;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -42,20 +44,25 @@ public class Anticipo {
* <p>
* Valores válidos: "04", "05", "06"
*/
@Schema(example = "04", description = "Catalog 53", required = true, allowableValues = { "04", "05", "06" })
private String tipo;

/**
* Serie y número de comprobante del anticipo, por ejemplo "F123-4"
*/
@Schema(example = "F123-4", required = true)
private String comprobanteSerieNumero;

/**
* Catalog 12
* Código de tipo de documento del {@link #comprobanteSerieNumero}.
*/
@Schema(description = "Catalog 12. Tipo de documento del comprobante de anticipo")
private String comprobanteTipo;

/**
* Monto prepagado o anticipado
*/
@Schema(example = "10", required = true, minimum = "0", exclusiveMinimum = true)
private BigDecimal monto;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
import java.math.BigDecimal;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;

@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@
*/
package io.github.project.openubl.xbuilder.content.models.standard.general;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import lombok.extern.jackson.Jacksonized;

/**
* Clase base para CreditNote y DebitNote.
*
* @author <a href="mailto:carlosthe19916@gmail.com">Carlos Feria</a>
*/
@Jacksonized
@Data
@SuperBuilder
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package io.github.project.openubl.xbuilder.content.models.standard.general;

import io.swagger.v3.oas.annotations.media.Schema;
import java.math.BigDecimal;
import java.time.LocalDate;
import lombok.AllArgsConstructor;
Expand All @@ -37,10 +38,12 @@ public class CuotaDePago {
/**
* Importe de la cuota
*/
@Schema(required = true, minimum = "0", exclusiveMinimum = true)
private BigDecimal importe;

/**
* Fecha de pago de la cuota
*/
@Schema(description = "Ejemplo 2022-12-25", required = true, pattern = "^\\d{4}-\\d{2}-\\d{2}$")
private LocalDate fechaPago;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
*/
package io.github.project.openubl.xbuilder.content.models.standard.general;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import lombok.extern.jackson.Jacksonized;

@Jacksonized
@Data
@SuperBuilder
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package io.github.project.openubl.xbuilder.content.models.standard.general;

import io.swagger.v3.oas.annotations.media.Schema;
import java.math.BigDecimal;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -36,13 +37,21 @@ public class Detraccion {
/**
* Catalog59
**/
@Schema(description = "Catalogo 59", required = true)
private String medioDePago;

@Schema(required = true)
private String cuentaBancaria;

/**
* Catalog54
**/
@Schema(description = "Catalog 54", required = true)
private String tipoBienDetraido;

@Schema(required = true, minimum = "0", maximum = "1", exclusiveMinimum = true)
private BigDecimal porcentaje;

@Schema(required = true, minimum = "0", exclusiveMinimum = true)
private BigDecimal monto;
}
Loading