forked from project-openubl/xhandler-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Carlos Feria <[email protected]>
- Loading branch information
1 parent
2c431f4
commit 847213e
Showing
10 changed files
with
407 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: Openubl | ||
description: Enviar archivos XML a la SUNAT API | ||
license: | ||
name: Apache License, Version 2.0 | ||
identifier: Apache-2.0 | ||
version: 0.1.1 | ||
paths: | ||
/api/credentials: | ||
get: | ||
operationId: list_credentials | ||
responses: | ||
'200': | ||
description: List credentials | ||
post: | ||
operationId: create_credentials | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/NewCredentialsDto' | ||
required: true | ||
responses: | ||
'200': | ||
description: Create credentials | ||
/api/credentials/{credentials_id}: | ||
get: | ||
operationId: get_credentials | ||
parameters: | ||
- name: credentials_id | ||
in: path | ||
required: true | ||
schema: | ||
type: integer | ||
format: int32 | ||
responses: | ||
'200': | ||
description: Get credential | ||
put: | ||
operationId: update_credentials | ||
parameters: | ||
- name: credentials_id | ||
in: path | ||
required: true | ||
schema: | ||
type: integer | ||
format: int32 | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/NewCredentialsDto' | ||
required: true | ||
responses: | ||
'204': | ||
description: Update credentials | ||
delete: | ||
operationId: delete_credentials | ||
parameters: | ||
- name: credentials_id | ||
in: path | ||
required: true | ||
schema: | ||
type: integer | ||
format: int32 | ||
responses: | ||
'204': | ||
description: Delete credentials | ||
/api/documents: | ||
get: | ||
operationId: list_documents | ||
responses: | ||
'200': | ||
description: List documents | ||
/api/documents/{document_id}/download: | ||
get: | ||
operationId: get_document_file | ||
parameters: | ||
- name: document_id | ||
in: path | ||
required: true | ||
schema: | ||
type: integer | ||
format: int32 | ||
responses: | ||
'200': | ||
description: Get document's file | ||
/api/documents/{document_id}/send: | ||
post: | ||
operationId: send_document | ||
parameters: | ||
- name: document_id | ||
in: path | ||
required: true | ||
schema: | ||
type: integer | ||
format: int32 | ||
responses: | ||
'200': | ||
description: Get document's file | ||
/q/health/live: | ||
get: | ||
operationId: liveness | ||
responses: | ||
'200': | ||
description: Liveness | ||
/q/health/read: | ||
get: | ||
operationId: readiness | ||
responses: | ||
'200': | ||
description: Readiness | ||
components: | ||
schemas: | ||
NewCredentialsDto: | ||
type: object | ||
required: | ||
- name | ||
- username_sol | ||
- password_sol | ||
- client_id | ||
- client_secret | ||
- url_invoice | ||
- url_despatch | ||
- url_perception_retention | ||
- supplier_ids_applied_to | ||
properties: | ||
client_id: | ||
type: string | ||
client_secret: | ||
type: string | ||
description: | ||
type: | ||
- string | ||
- 'null' | ||
name: | ||
type: string | ||
password_sol: | ||
type: string | ||
supplier_ids_applied_to: | ||
type: array | ||
items: | ||
type: string | ||
url_despatch: | ||
type: string | ||
url_invoice: | ||
type: string | ||
url_perception_retention: | ||
type: string | ||
username_sol: | ||
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use actix_web::App; | ||
use utoipa::{ | ||
openapi::{Info, License}, | ||
OpenApi, | ||
}; | ||
use utoipa_actix_web::AppExt; | ||
|
||
use crate::{configure_api, configure_q}; | ||
|
||
#[derive(OpenApi)] | ||
#[openapi()] | ||
pub struct ApiDoc; | ||
|
||
pub fn default_openapi_info() -> Info { | ||
let mut info = Info::new("Openubl", env!("CARGO_PKG_VERSION")); | ||
info.description = Some("Enviar archivos XML a la SUNAT API".into()); | ||
info.license = { | ||
let mut license = License::new("Apache License, Version 2.0"); | ||
license.identifier = Some("Apache-2.0".into()); | ||
Some(license) | ||
}; | ||
info | ||
} | ||
|
||
pub async fn create_openapi() -> anyhow::Result<utoipa::openapi::OpenApi> { | ||
let (_, mut openapi) = App::new() | ||
.into_utoipa_app() | ||
.service(utoipa_actix_web::scope("/q").configure(configure_q)) | ||
.service(utoipa_actix_web::scope("/api").configure(configure_api)) | ||
.split_for_parts(); | ||
|
||
openapi.info = default_openapi_info(); | ||
|
||
Ok(openapi) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[package] | ||
name = "openubl-xtask" | ||
version.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
|
||
[[bin]] | ||
name = "xtask" | ||
path = "src/main.rs" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
openubl-server = { workspace = true } | ||
|
||
anyhow = { workspace = true } | ||
clap = { workspace = true, features = ["derive", "env"] } | ||
tokio = { workspace = true, features = ["full"] } |
Oops, something went wrong.