Skip to content
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

refactor(openapi)!: convert bundling library to openapi-cli #50

Merged
merged 7 commits into from
Feb 10, 2021

Conversation

kleyow
Copy link
Contributor

@kleyow kleyow commented Feb 8, 2021

No description provided.

@kleyow kleyow force-pushed the refactor/openapi-cli branch from 40b7971 to 8fdd346 Compare February 9, 2021 16:06
@kleyow kleyow changed the title refactor!: convert bundling library to openapi-cli refactor(openapi)!: convert bundling library to openapi-cli Feb 9, 2021
@kleyow kleyow marked this pull request as ready for review February 9, 2021 17:37
Copy link
Contributor

@eoln eoln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kleyow GJ! Approved

I put a lot of comments related to some inconsistency and lack of regexp patterns & enums inherited from the original specification.

@elnyry-sam-k @lewisdaly we should decide what to do about -> should we create issue and delegate complaints of very poor API spec quality to some board?

Or maybe we should fix these problems in api-snippets - if yes then definitely in other story...

Worth mentioning that api-snippets restructuring allows spotting these imperfections much easier than reading original spec doc...

```

Modify swagger file to reference `api-snippets`.

ex.
```yaml
Money:
$ref: /path/to/node_modules/@mojaloop/api-snippets/v1.0/openapi3/schemas/Money.yaml
$ref: /path/to/node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Money.yaml
Copy link
Contributor

@eoln eoln Feb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kleyow we need to think about short paths -> maybe we can create symlinks in postinstall npm script? If we are introducing braking change this little improvement could be very handy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I will make a ticket to investigate this.

@@ -0,0 +1,10 @@
title: Amount
type: string
pattern: '^([0]|([1-9][0-9]{0,17}))([.][0-9]{0,3}[1-9])?$'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this pattern doesn't allow the values with zero at the end of the decimal part, for example: 100.00, 100.10, ....

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is by design, why is it wrong? isn't that how match works? zeroes at the end after decimals add zero value and not necessary :P isn't it?

partyIdInfo:
$ref: ./PartyIdInfo.yaml
description: 'Party Id type, id, sub ID or type, and FSP Id.'
merchantClassificationCode:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in other places, merchantClassifiactionCode is restricted to have only four digits...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes merchantClassifiactionCode is different from FSP ID, sorry I'm not understanding the issue with that

description: Data model for the complex type PartyComplexName.
properties:
firstName:
type: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about the FirstName type defined above? - it has quite a restricted regexp pattern and here is allowed an unrestricted string

type: string
description: Currency of the amount.
example: USD
amount:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about using Amount type defined above?

@@ -0,0 +1,6 @@
schema:
type: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrestricted string, some pattern here would be great!

description: |
The `Accept` header field indicates the version of the API the client
would like the server to use.
description: >-
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again unrestricted string where some regexp pattern would place here nicely

name: Date
in: header
schema:
type: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Date should be guarded by regexp

name: FSPIOP-HTTP-Method
in: header
schema:
type: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not restricted string where a pattern or enum should be applied

@@ -3,6 +3,6 @@ in: header
schema:
type: string
required: false
description: |
description: >-
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signatures are base64 encoded string so we can guard this by regexp pattern...

@elnyry-sam-k
Copy link
Member

@eoln - great work reviewing the giant PR :-).. on the issues / enhancements you mentioned as comments, can we take those separately and not include them here ( for example, regex patterns on headers, etc)

@eoln
Copy link
Contributor

eoln commented Feb 10, 2021

@elnyry-sam-k that is my idea, move improvements to another story, we are chopping big spec here only

@lewisdaly lewisdaly merged commit 5374eb7 into mojaloop:master Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants