From f9ae70d4ad92f356f8cd2799dd7a9262a1975b49 Mon Sep 17 00:00:00 2001 From: maguimarijuan Date: Thu, 30 Apr 2020 17:11:31 -0300 Subject: [PATCH 1/2] fix bug --- README.md | 13 +++------ lib/client-functions.js | 2 +- package-lock.json | 2 +- schemas/base.yml | 32 +++++++++++----------- schemas/client.yml | 4 +-- schemas/create.yml | 60 ++++++++++++++++++++--------------------- schemas/created.yml | 54 ++++++++++++++++++------------------- 7 files changed, 80 insertions(+), 87 deletions(-) diff --git a/README.md b/README.md index 52f8147..388bd55 100644 --- a/README.md +++ b/README.md @@ -79,12 +79,6 @@ module.exports = helper({ ...functions, ...clientFunctions ] -}, { - package: { - include: [ - // your packages - ] - } }); ``` :warning: If they exist, delete the functions from the `./serverless/functions.json` file. @@ -103,15 +97,14 @@ At ` ./schemas/event-listeners/id/client` add this file: At ` ./events/src/id/` add this file: - [client.yml](schemas/client.yml) - Finally, create or update `./.nycrc` to avoid coverage leaks: ``` { "exclude": [ //... your files - src/event-listeners/id/client/created.js - src/models/client.js, - src/api/client/post.js + "src/event-listeners/id/client/created.js", + "src/models/client.js, + "src/api/client/post.js" ] } ``` diff --git a/lib/client-functions.js b/lib/client-functions.js index bab2781..a8c88a2 100644 --- a/lib/client-functions.js +++ b/lib/client-functions.js @@ -2,7 +2,7 @@ const path = require('path'); -const modelPath = path.join(process.env.MS_PATH || '', 'models', 'client'); +const modelPath = path.join(process.env.MS_PATH || '', 'models', 'client.js'); module.exports = [ diff --git a/package-lock.json b/package-lock.json index 6d1ce8e..2aa62e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@janiscommerce/client-creator", - "version": "1.0.0", + "version": "1.0.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/schemas/base.yml b/schemas/base.yml index 6d348d0..f1de546 100644 --- a/schemas/base.yml +++ b/schemas/base.yml @@ -1,19 +1,19 @@ components: - schemas: + schemas: - Clients: - description: The new clients to create - type: object - properties: - clients: - description: The client codes array - type: array - items: - description: The client code - type: string - readOnly: true - example: - clients: - - 'some-client' - - 'other-client' \ No newline at end of file + Clients: + description: The new clients to create + type: object + properties: + clients: + description: The client codes array + type: array + items: + description: The client code + type: string + readOnly: true + example: + clients: + - 'some-client' + - 'other-client' diff --git a/schemas/client.yml b/schemas/client.yml index 8e01453..df554f3 100644 --- a/schemas/client.yml +++ b/schemas/client.yml @@ -2,5 +2,5 @@ entity: client event: created listeners: - - namespace: client - method: created-listener \ No newline at end of file + - namespace: id-client + method: created-listener diff --git a/schemas/create.yml b/schemas/create.yml index 977e369..dbc6a0c 100644 --- a/schemas/create.yml +++ b/schemas/create.yml @@ -1,35 +1,35 @@ paths: - /client: - post: - x-janis-namespace: client - x-janis-method: create - operationId: createClient - tags: - - Client - summary: Create a new client - security: - - ApiKey: [] - ApiSecret: [] - requestBody: - description: The clients to create - required: true + /client: + post: + x-janis-namespace: client + x-janis-method: create + operationId: createClient + tags: + - Client + summary: Create a new client + security: + - ApiKey: [] + ApiSecret: [] + requestBody: + description: The clients to create + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/Clients" + responses: + "200": + description: Client created content: application/json: schema: - $ref: "#/components/schemas/Clients" - responses: - "200": - description: Client created - content: - application/json: - schema: - type: object - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "500": - $ref: "#/components/responses/InternalError" \ No newline at end of file + type: object + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "500": + $ref: "#/components/responses/InternalError" diff --git a/schemas/created.yml b/schemas/created.yml index 03fdd19..bee8346 100644 --- a/schemas/created.yml +++ b/schemas/created.yml @@ -1,28 +1,28 @@ paths: - /listener/client/created: - post: - x-janis-namespace: client - x-janis-method: created-listener - tags: - - Client - summary: Client created event listener - security: - - ApiKey: [] - ApiSecret: [] - description: Client created event listener - operationId: clientCreatedListener - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/listenerEvent' - responses: - '200': - $ref: '#/components/responses/GenericSuccess' - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '500': - $ref: '#/components/responses/InternalError' \ No newline at end of file + /listener/id/client/created: + post: + x-janis-namespace: id-client + x-janis-method: created-listener + tags: + - Client + summary: Client created event listener + security: + - ApiKey: [] + ApiSecret: [] + description: Client created event listener + operationId: clientCreatedListener + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/listenerEvent' + responses: + '200': + $ref: '#/components/responses/GenericSuccess' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '500': + $ref: '#/components/responses/InternalError' \ No newline at end of file From af570b195964e8214fd068beecae3c9c5fc94cd9 Mon Sep 17 00:00:00 2001 From: maguimarijuan Date: Thu, 30 Apr 2020 17:21:48 -0300 Subject: [PATCH 2/2] fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 388bd55..38b9407 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ Finally, create or update `./.nycrc` to avoid coverage leaks: "exclude": [ //... your files "src/event-listeners/id/client/created.js", - "src/models/client.js, + "src/models/client.js", "src/api/client/post.js" ] }