kikocis/gaiax-credentials-tool public
Changesets · Branches · Tags · Compare
| Changeset | 17599465a4314590384dd6af6e0739f360bef3507c57bbd63e06f8b6096bbb88 |
|---|---|
| Author | KikoCis <kikocisneros@gmail.com> · 2024-12-03 10:09 +01:00 |
| Committer | KikoCis <kikocisneros@gmail.com> · 2024-12-03 10:09 +01:00 |
| Parents | df2328c7488b |
2 files changed
added src/examples/openapi.yml +53 −0
| @@ -0,0 +1,53 @@ | ||
| 1 | +openapi: 3.0.0 | |
| 2 | +info: | |
| 3 | + title: API de Ejemplo | |
| 4 | + description: Esta es una API de ejemplo para propósitos de demostración. | |
| 5 | + version: 1.0.0 | |
| 6 | +servers: | |
| 7 | + - url: https://api.ejemplo.com/v1 | |
| 8 | +paths: | |
| 9 | + /usuarios: | |
| 10 | + get: | |
| 11 | + summary: Obtiene una lista de usuarios | |
| 12 | + responses: | |
| 13 | + '200': | |
| 14 | + description: Lista de usuarios | |
| 15 | + content: | |
| 16 | + application/json: | |
| 17 | + schema: | |
| 18 | + type: array | |
| 19 | + items: | |
| 20 | + type: object | |
| 21 | + properties: | |
| 22 | + id: | |
| 23 | + type: integer | |
| 24 | + example: 1 | |
| 25 | + nombre: | |
| 26 | + type: string | |
| 27 | + example: Juan Pérez | |
| 28 | + /usuarios/{id}: | |
| 29 | + get: | |
| 30 | + summary: Obtiene un usuario por ID | |
| 31 | + parameters: | |
| 32 | + - name: id | |
| 33 | + in: path | |
| 34 | + required: true | |
| 35 | + description: ID del usuario | |
| 36 | + schema: | |
| 37 | + type: integer | |
| 38 | + responses: | |
| 39 | + '200': | |
| 40 | + description: Detalles del usuario | |
| 41 | + content: | |
| 42 | + application/json: | |
| 43 | + schema: | |
| 44 | + type: object | |
| 45 | + properties: | |
| 46 | + id: | |
| 47 | + type: integer | |
| 48 | + example: 1 | |
| 49 | + nombre: | |
| 50 | + type: string | |
| 51 | + example: Juan Pérez | |
| 52 | + '404': | |
| 53 | + description: Usuario no encontrado | |
| No newline at the end of the file |
modified src/index.js +5 −1
| @@ -54,6 +54,10 @@ | ||
| 54 | 54 | |
| 55 | 55 | async function actionCredentials(options) { |
| 56 | 56 | try { |
| 57 | + if (!options.apiSpec) { | |
| 58 | + throw new Error(chalk.red("Es necesario especificar la ruta a la especificación OpenAPI/AsyncAPI usando --api-spec")); | |
| 59 | + } | |
| 60 | + | |
| 57 | 61 | const config = getConfig(); |
| 58 | 62 | |
| 59 | 63 | // Validar certificado |
| @@ -330,11 +334,11 @@ | ||
| 330 | 334 | program |
| 331 | 335 | .command("credentials") |
| 332 | 336 | .description("Build and sign Gaia-X Self-Descriptions") |
| 337 | + .requiredOption("--api-spec <path>", "Path to OpenAPI/AsyncAPI specification") | |
| 333 | 338 | .option("-c, --cert <path>", "Path to trust anchor certificate") |
| 334 | 339 | .option("-k, --key <path>", "Path to private key") |
| 335 | 340 | .option("--allow-non-evssl", "Allow non-EV-SSL certificates") |
| 336 | 341 | .option("--gxdch <url>", "GXDCH instance URL", "https://compliance.gaia-x.aire.es") |
| 337 | - .option("--api-spec <path>", "Path to OpenAPI/AsyncAPI specification") | |
| 338 | 342 | .action(actionCredentials); |
| 339 | 343 | |
| 340 | 344 | program |