Elffuss BraidHub

kikocis/gaiax-credentials-tool public

FIX
Changeset17599465a4314590384dd6af6e0739f360bef3507c57bbd63e06f8b6096bbb88
AuthorKikoCis <kikocisneros@gmail.com> · 2024-12-03 10:09 +01:00
CommitterKikoCis <kikocisneros@gmail.com> · 2024-12-03 10:09 +01:00
Parentsdf2328c7488b

Browse the files at this changeset

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 @@
5454
5555 async function actionCredentials(options) {
5656 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+
5761 const config = getConfig();
5862
5963 // Validar certificado
@@ -330,11 +334,11 @@
330334 program
331335 .command("credentials")
332336 .description("Build and sign Gaia-X Self-Descriptions")
337+ .requiredOption("--api-spec <path>", "Path to OpenAPI/AsyncAPI specification")
333338 .option("-c, --cert <path>", "Path to trust anchor certificate")
334339 .option("-k, --key <path>", "Path to private key")
335340 .option("--allow-non-evssl", "Allow non-EV-SSL certificates")
336341 .option("--gxdch <url>", "GXDCH instance URL", "https://compliance.gaia-x.aire.es")
337- .option("--api-spec <path>", "Path to OpenAPI/AsyncAPI specification")
338342 .action(actionCredentials);
339343
340344 program