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

feat: add all{components} functions #969

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

KhudaDad414
Copy link
Member

Description

allServerVariables(): ServerVariablesInterface;
allParameters(): ChannelParametersInterface;
allCorrelationIds(): CorrelationIdsInterface;
allTags(): TagsInterface;
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

@smoya I'm a little confused about where to add the allReplies function. If I add it here, then v2 also needs to implement it. But v2 doesn't have replies. I see three possible approaches:

  1. Remove allReplies from parser-api since it can't be implemented for v2.
  2. Add it here and return an empty array for the v2 implementation.
  3. Add allReplies to v3 only.

I would appreciate some insight on this.


import type { v3 } from '../../spec-types';

export class AsyncAPIDocument extends BaseModel<v3.AsyncAPIObject> implements AsyncAPIDocumentInterface {
allSecuritySchemes(): SecuritySchemesInterface {
return this.securitySchemes();
Copy link
Member

@smoya smoya Apr 8, 2024

Choose a reason for hiding this comment

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

I see two issues here:

  1. If allSecuritySchemes does the same as securitySchemes, then this is redundant.
  2. I believe securitySchemes method implementation is wrong ATM because it is only returning Security Schemes from components but instead would need to return from, for example, Operations in the root document.

cc @jonaslagoni please double 👀 just in case I'm delirious.

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. If allSecuritySchemes does the same as securitySchemes, then this is redundant.

I agree. it has only been added for the sake of completeness.

  1. I believe securitySchemes method implementation is wrong ATM because it is only returning Security Schemes from components but instead would need to return from, for example, Operations in the root document.

the problem is that when I try to access the security scheme of an specific operation or operationTrait it returns SecurityRequirements[] instead of SecuritySchemes.

not sure if this is a bug or I am missing something.

Copy link
Member Author

Choose a reason for hiding this comment

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

@smoya pingy pongy.

Copy link

sonarcloud bot commented Apr 18, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link

sonarcloud bot commented Jun 11, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

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.

2 participants