Skip to content

refactor: cleanup interfaces + add missing methods from parser-api - #597

Merged
asyncapi-bot merged 5 commits into
asyncapi:next-majorfrom
smoya:feat/cleanupInterfaces
Sep 12, 2022
Merged

asyncapi-bot merged 5 commits into
asyncapi:next-majorfrom
smoya:feat/cleanupInterfaces

Conversation

@smoya

@smoya smoya commented Sep 7, 2022

Copy link
Copy Markdown
Member

Description

This PR does a cleanup and sync with the latest changes on parser-api made in asyncapi/parser-api#71 (comment).

Related issue(s)

Comment thread src/models/security-scheme.ts Outdated
Comment on lines +5 to +6
export type SecuritySchemaType = 'userPassword' | 'apiKey' | 'X509' | 'symmetricEncryption' | 'asymmetricEncryption' | 'httpApiKey' | 'http' | 'oauth2' | 'openIdConnect' | 'plain' | 'scramSha256' | 'scramSha512' | 'gssapi';
export type SecuritySchemaLocation = 'user' | 'password' | 'query' | 'header' | 'header' | 'cookie';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm 🤔 Probably we should move that types to the spec-types/v2. SecuritySchemaType probably I wrote but we have missed SecuritySchemaLocation here. Could you move them?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Those are already in spec-types/v2. The question is, should we also add all of them (meaning all locations possible, no matters the version of the spec) in the interface?That was the idea behind this in parser-api: https://github.com/asyncapi/parser-api/pull/71/files#diff-ac35ac6e0b0ad3629802a0e04076aa18e94da614f5392e1164dcaacdfe3ee198R375.
WDYT?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, we don't make different spec types for 2.0.0, 2.1.0 etc. v2 spec types is for 2.x.x, so please use types from spec-types/v2.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

v2 spec types is for 2.x.x, so please use types from spec-types/v2

But we are talking about types located in the interface (src/models/security-scheme.ts). Not related with the implementation.

@smoya smoya Sep 12, 2022 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Do you mean we should just use string as type here, and in the implementation (v2, v3...) to set those values as unique possible values for that string?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can even use v2.SecuritySchemaLocation | v3.SecuritySchemaLocation type in the future, but probably better will be string and then in implementation cast type to the v2.SecuritySchemaLocation. Please change to the string and move types to the spec-types/v2

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done!

Comment thread src/models/v2/extensions.ts Resolved
Comment thread src/models/v2/extensions.ts Resolved
@smoya
smoya requested review from magicmatatjahu and removed request for asyncapi-bot-eve, derberg, fmvilas and jonaslagoni September 12, 2022 08:34
@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@magicmatatjahu magicmatatjahu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@magicmatatjahu

Copy link
Copy Markdown
Member

/rtm

@asyncapi-bot
asyncapi-bot merged commit a27ed4a into asyncapi:next-major Sep 12, 2022
@smoya
smoya deleted the feat/cleanupInterfaces branch September 12, 2022 08:55
@magicmatatjahu magicmatatjahu mentioned this pull request Sep 12, 2022
14 of 20 tasks
magicmatatjahu pushed a commit to magicmatatjahu/parser-js that referenced this pull request Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants