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

Implement use of linting rule set for Carrier Billing API #126

Closed
bigludo7 opened this issue Dec 12, 2023 · 12 comments · Fixed by #134, #137 or #140
Closed

Implement use of linting rule set for Carrier Billing API #126

bigludo7 opened this issue Dec 12, 2023 · 12 comments · Fixed by #134, #137 or #140
Assignees
Labels
subproject management Actions related to repository/releases

Comments

@bigludo7
Copy link
Collaborator

Problem description
Implement use of linting rule set for Carrier Billing API.
what we have to do is well documented in Commonalities:
camaraproject/Commonalities#110
camaraproject/Commonalities#74

Expected action
Check our API with linting rule set
provide feedback to commonalities team

Additional context
cc: @rartych who asked project volunteer to perform this action.

@bigludo7 bigludo7 added the subproject management Actions related to repository/releases label Dec 12, 2023
@PedroDiez PedroDiez self-assigned this Dec 12, 2023
@PedroDiez
Copy link
Collaborator

Linter rules output: https://github.com/PedroDiez/CarrierBillingCheckOut/actions/runs/7642915617/job/20823677108?pr=1

Main topics are API spec errors needed to be fixed. Take advantage of #134 to deal with them

@PedroDiez
Copy link
Collaborator

Re-open explicitly issue, as want to check intermediate outputs

@PedroDiez
Copy link
Collaborator

PedroDiez commented Jan 30, 2024

Considerations/Feedback:

    1. 130:7 error oas3-valid-media-example "status" property type must be string: Do not get the result of this output and if any actions required
    1. 131:13 error camara-parameter-casing-convention /payments should be kebab-case: must be kebab case: False positive. It appears several times. No action required
    1. 135:13 warning oas3-operation-security-defined "carrier-billing:payments:create" must be listed among scopes. paths./payments.post.security[0].openId[0]: Same as in Blockchain, rule removed. This error appears several times (one per API scope). No actions required
    1. 151:23 error oas3-valid-media-example "status" property type must be string paths./payments.post.callbacks.notifications: Do not get the result of this output and if any actions required
    1. 192:9 error parser Mapping key must be a string scalar rather than number paths./payments.post.responses[201]: Appears many times, do not see the action point here
    1. 1210:21 error oas3-valid-media-example "status" property type must be string components.responses.Generic400.content.application/json.example.status: Appears several times in different scenarios. "status" is an integer as per commonalities. Do not see the action here
    1. Warnings with no impact in API Spec

@PedroDiez
Copy link
Collaborator

Please @rartych when you can, in order on how to proceed with topics: i, iv, v and vi

@PedroDiez
Copy link
Collaborator

@PedroDiez
Copy link
Collaborator

Update the files from the PR. and test them. Test today 07/FEB

@PedroDiez
Copy link
Collaborator

Tested linter again:

  • Format Errors: (check and fix in API Spec)

code/API_definitions/carrier_billing.yaml
Error: 16:19 [trailing-spaces] trailing spaces
Error: 19:26 [trailing-spaces] trailing spaces
Error: 22:26 [trailing-spaces] trailing spaces
Error: 28:1 [trailing-spaces] trailing spaces
Error: 43:35 [trailing-spaces] trailing spaces
Error: 55:1 [trailing-spaces] trailing spaces
Error: 78:1 [trailing-spaces] trailing spaces
Error: 135:11 [indentation] wrong indentation: expected 12 but found 10
Error: 218:11 [indentation] wrong indentation: expected 12 but found 10
Error: 223:22 [trailing-spaces] trailing spaces
Error: 230:87 [trailing-spaces] trailing spaces
Error: 234:135 [trailing-spaces] trailing spaces
Error: 274:11 [indentation] wrong indentation: expected 12 but found 10
Error: 317:11 [indentation] wrong indentation: expected 12 but found 10
Error: 412:11 [indentation] wrong indentation: expected 12 but found 10
Error: 471:11 [indentation] wrong indentation: expected 12 but found 10
Error: 517:11 [indentation] wrong indentation: expected 12 but found 10
Error: 988:29 [trailing-spaces] trailing spaces
Error: 1176:54 [trailing-spaces] trailing spaces
Error: 1317:21 [trailing-spaces] trailing spaces
Error: 1401:123 [trailing-spaces] trailing spaces
Error: 1417:48 [trailing-spaces] trailing spaces
Error: 1450:123 [trailing-spaces] trailing spaces
Error: 1475:197 [trailing-spaces] trailing spaces
Error: 1671:32 [trailing-spaces] trailing spaces
Error: 1680:16 [trailing-spaces] trailing spaces
Error: 1687:24 [trailing-spaces] trailing spaces

@PedroDiez
Copy link
Collaborator

  • Spec errors:

`
[spectral] documentation/SupportingDocuments/carrier_billing_payment.yaml - ERROR - 1 error(s)
--Error detail:

/github/workspace/documentation/SupportingDocuments/carrier_billing_payment.yaml
26:10 warning camara-routes-description Functionality method description Warning: Each method should have description. paths./payments.post
26:10 warning operation-description Operation "description" must be present and non-empty string. paths./payments.post
32:9 warning operation-tag-defined Operation tags must be defined in global tags. paths./payments.post.tags[0]
43:9 error parser Mapping key must be a string scalar rather than number paths./payments.post.responses[201]
49:9 error parser Mapping key must be a string scalar rather than number paths./payments.post.responses[400]
60:29 error oas3-valid-media-example "status" property type must be string paths./payments.post.responses[400].content.application/json.examples.Generic400.value.status
66:29 error oas3-valid-media-example "status" property type must be string paths./payments.post.responses[400].content.application/json.examples.wrongCurrency.value.status
72:29 error oas3-valid-media-example "status" property type must be string paths./payments.post.responses[400].content.application/json.examples.duplicateClientCorrelator.value.status
78:29 error oas3-valid-media-example "status" property type must be string paths./payments.post.responses[400].content.application/json.examples.unauthorizedAmount.value.status
80:9 error parser Mapping key must be a string scalar rather than number paths./payments.post.responses[401]
86:9 error parser Mapping key must be a string scalar rather than number paths./payments.post.responses[403]
92:9 error parser Mapping key must be a string scalar rather than number paths./payments.post.responses[409]
98:9 error parser Mapping key must be a string scalar rather than number paths./payments.post.responses[500]
104:9 error parser Mapping key must be a string scalar rather than number paths./payments.post.responses[503]
116:9 warning operation-tag-defined Operation tags must be defined in global tags. paths./payments.get.tags[0]
125:9 error parser Mapping key must be a string scalar rather than number paths./payments.get.responses[200]
126:26 error no-$ref-siblings $ref must not be placed next to any other properties paths./payments.get.responses[200].description
128:9 error parser Mapping key must be a string scalar rather than number paths./payments.get.responses[400]
139:29 error oas3-valid-media-example "status" property type must be string paths./payments.get.responses[400].content.application/json.examples.Generic400.value.status
145:29 error oas3-valid-media-example "status" property type must be string paths./payments.get.responses[400].content.application/json.examples.endUserIdRequired.value.status
151:29 error oas3-valid-media-example "status" property type must be string paths./payments.get.responses[400].content.application/json.examples.paymentIdRequired.value.status
153:9 error parser Mapping key must be a string scalar rather than number paths./payments.get.responses[401]
155:9 error parser Mapping key must be a string scalar rather than number paths./payments.get.responses[403]
157:9 error parser Mapping key must be a string scalar rather than number paths./payments.get.responses[409]
165:25 error oas3-valid-media-example "status" property type must be string paths./payments.get.responses[409].content.application/json.example.status
167:9 error parser Mapping key must be a string scalar rather than number paths./payments.get.responses[500]
175:25 error oas3-valid-media-example "status" property type must be string paths./payments.get.responses[500].content.application/json.example.status
177:9 error parser Mapping key must be a string scalar rather than number paths./payments.get.responses[503]
186:9 warning operation-tag-defined Operation tags must be defined in global tags. paths./payments/{paymentId}.get.tags[0]
198:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}.get.responses[200]
204:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}.get.responses[400]
215:29 error oas3-valid-media-example "status" property type must be string paths./payments/{paymentId}.get.responses[400].content.application/json.examples.Generic400.value.status
221:29 error oas3-valid-media-example "status" property type must be string paths./payments/{paymentId}.get.responses[400].content.application/json.examples.endUserIdRequired.value.status
227:29 error oas3-valid-media-example "status" property type must be string paths./payments/{paymentId}.get.responses[400].content.application/json.examples.paymentIdRequired.value.status
229:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}.get.responses[401]
231:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}.get.responses[403]
233:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}.get.responses[404]
235:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}.get.responses[500]
241:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}.get.responses[503]
244:10 warning camara-routes-description Functionality method description Warning: Each method should have description. paths./payments/prepare.post
244:10 warning operation-description Operation "description" must be present and non-empty string. paths./payments/prepare.post
250:9 warning operation-tag-defined Operation tags must be defined in global tags. paths./payments/prepare.post.tags[0]
261:9 error parser Mapping key must be a string scalar rather than number paths./payments/prepare.post.responses[201]
267:9 error parser Mapping key must be a string scalar rather than number paths./payments/prepare.post.responses[400]
278:29 error oas3-valid-media-example "status" property type must be string paths./payments/prepare.post.responses[400].content.application/json.examples.Generic400.value.status
284:29 error oas3-valid-media-example "status" property type must be string paths./payments/prepare.post.responses[400].content.application/json.examples.endUserIdRequired.value.status
290:29 error oas3-valid-media-example "status" property type must be string paths./payments/prepare.post.responses[400].content.application/json.examples.paymentIdRequired.value.status
292:9 error parser Mapping key must be a string scalar rather than number paths./payments/prepare.post.responses[401]
294:9 error parser Mapping key must be a string scalar rather than number paths./payments/prepare.post.responses[403]
296:9 error parser Mapping key must be a string scalar rather than number paths./payments/prepare.post.responses[409]
304:25 error oas3-valid-media-example "status" property type must be string paths./payments/prepare.post.responses[409].content.application/json.example.status
306:9 error parser Mapping key must be a string scalar rather than number paths./payments/prepare.post.responses[500]
314:25 error oas3-valid-media-example "status" property type must be string paths./payments/prepare.post.responses[500].content.application/json.example.status
316:9 error parser Mapping key must be a string scalar rather than number paths./payments/prepare.post.responses[503]
319:10 warning camara-routes-description Functionality method description Warning: Each method should have description. paths./payments/{paymentId}/confirm.post
319:10 warning operation-description Operation "description" must be present and non-empty string. paths./payments/{paymentId}/confirm.post
325:9 warning operation-tag-defined Operation tags must be defined in global tags. paths./payments/{paymentId}/confirm.post.tags[0]
344:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}/confirm.post.responses[202]
346:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}/confirm.post.responses[400]
357:29 error oas3-valid-media-example "status" property type must be string paths./payments/{paymentId}/confirm.post.responses[400].content.application/json.examples.Generic400.value.status
363:29 error oas3-valid-media-example "status" property type must be string paths./payments/{paymentId}/confirm.post.responses[400].content.application/json.examples.endUserIdRequired.value.status
369:29 error oas3-valid-media-example "status" property type must be string paths./payments/{paymentId}/confirm.post.responses[400].content.application/json.examples.paymentIdRequired.value.status
371:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}/confirm.post.responses[401]
373:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}/confirm.post.responses[403]
375:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}/confirm.post.responses[409]
383:25 error oas3-valid-media-example "status" property type must be string paths./payments/{paymentId}/confirm.post.responses[409].content.application/json.example.status
385:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}/confirm.post.responses[500]
393:25 error oas3-valid-media-example "status" property type must be string paths./payments/{paymentId}/confirm.post.responses[500].content.application/json.example.status
395:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}/confirm.post.responses[503]
399:10 warning camara-routes-description Functionality method description Warning: Each method should have description. paths./payments/{paymentId}/cancel.post
399:10 warning operation-description Operation "description" must be present and non-empty string. paths./payments/{paymentId}/cancel.post
405:9 warning operation-tag-defined Operation tags must be defined in global tags. paths./payments/{paymentId}/cancel.post.tags[0]
407:20 hint camara-operationid-casing-convention Operation Id must be in Camel case "must be camel case" paths./payments/{paymentId}/cancel.post.operationId
423:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}/cancel.post.responses[202]
425:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}/cancel.post.responses[400]
436:29 error oas3-valid-media-example "status" property type must be string paths./payments/{paymentId}/cancel.post.responses[400].content.application/json.examples.Generic400.value.status
442:29 error oas3-valid-media-example "status" property type must be string paths./payments/{paymentId}/cancel.post.responses[400].content.application/json.examples.endUserIdRequired.value.status
448:29 error oas3-valid-media-example "status" property type must be string paths./payments/{paymentId}/cancel.post.responses[400].content.application/json.examples.paymentIdRequired.value.status
450:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}/cancel.post.responses[401]
452:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}/cancel.post.responses[403]
454:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}/cancel.post.responses[409]
462:25 error oas3-valid-media-example "status" property type must be string paths./payments/{paymentId}/cancel.post.responses[409].content.application/json.example.status
464:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}/cancel.post.responses[500]
472:25 error oas3-valid-media-example "status" property type must be string paths./payments/{paymentId}/cancel.post.responses[500].content.application/json.example.status
474:9 error parser Mapping key must be a string scalar rather than number paths./payments/{paymentId}/cancel.post.responses[503]
480:11 warning operation-tag-defined Operation tags must be defined in global tags. paths./notifications.post.tags[0]
510:19 warning camara-properties-descriptions Property description is missing or empty: "CreatePayment.description" property must be truthy components.schemas.CreatePayment
524:13 warning camara-properties-descriptions Property description is missing or empty: "Payment.description" property must be truthy components.schemas.Payment
550:23 warning camara-properties-descriptions Property description is missing or empty: "AmountTransaction" property must be truthy components.schemas.AmountTransaction
550:23 warning camara-properties-descriptions Property description is missing or empty: "AmountTransaction.description" property must be truthy components.schemas.AmountTransaction
584:28 warning camara-properties-descriptions Property description is missing or empty: "AmountTransactionInput" property must be truthy components.schemas.AmountTransactionInput
584:28 warning camara-properties-descriptions Property description is missing or empty: "AmountTransactionInput.description" property must be truthy components.schemas.AmountTransactionInput
606:28 warning camara-properties-descriptions Property description is missing or empty: "PaymentAmountForCharge" property must be truthy components.schemas.PaymentAmountForCharge
606:28 warning camara-properties-descriptions Property description is missing or empty: "PaymentAmountForCharge.description" property must be truthy components.schemas.PaymentAmountForCharge
615:15 warning camara-properties-descriptions Property description is missing or empty: "EndUserId.description" property must be truthy components.schemas.EndUserId
623:48 warning camara-properties-descriptions Property description is missing or empty: "BodyAmountReservationTransactionForReserve.description" property must be truthy components.schemas.BodyAmountReservationTransactionForReserve
641:53 warning camara-properties-descriptions Property description is missing or empty: "BodyAmountReservationTransactionForReserveInput.description" property must be truthy components.schemas.BodyAmountReservationTransactionForReserveInput
655:44 warning camara-properties-descriptions Property description is missing or empty: "AmountReservationTransactionForReserve" property must be truthy components.schemas.AmountReservationTransactionForReserve
655:44 warning camara-properties-descriptions Property description is missing or empty: "AmountReservationTransactionForReserve.description" property must be truthy components.schemas.AmountReservationTransactionForReserve
689:49 warning camara-properties-descriptions Property description is missing or empty: "AmountReservationTransactionForReserveInput" property must be truthy components.schemas.AmountReservationTransactionForReserveInput
689:49 warning camara-properties-descriptions Property description is missing or empty: "AmountReservationTransactionForReserveInput.description" property must be truthy components.schemas.AmountReservationTransactionForReserveInput
711:29 warning camara-properties-descriptions Property description is missing or empty: "PaymentAmountForReserve" property must be truthy components.schemas.PaymentAmountForReserve
711:29 warning camara-properties-descriptions Property description is missing or empty: "PaymentAmountForReserve.description" property must be truthy components.schemas.PaymentAmountForReserve
720:56 warning camara-properties-descriptions Property description is missing or empty: "BodyAmountReservationTransactionForConfirmOrCancel.description" property must be truthy components.schemas.BodyAmountReservationTransactionForConfirmOrCancel
720:56 warning oas3-unused-component Potentially unused component has been detected. components.schemas.BodyAmountReservationTransactionForConfirmOrCancel
730:44 warning camara-properties-descriptions Property description is missing or empty: "BodyAmountReservationTransactionCancel.description" property must be truthy components.schemas.BodyAmountReservationTransactionCancel
730:44 warning oas3-unused-component Potentially unused component has been detected. components.schemas.BodyAmountReservationTransactionCancel
737:52 warning camara-properties-descriptions Property description is missing or empty: "AmountReservationTransactionForConfirmOrCancel" property must be truthy components.schemas.AmountReservationTransactionForConfirmOrCancel
737:52 warning camara-properties-descriptions Property description is missing or empty: "AmountReservationTransactionForConfirmOrCancel.description" property must be truthy components.schemas.AmountReservationTransactionForConfirmOrCancel
769:37 warning camara-properties-descriptions Property description is missing or empty: "PaymentAmountForConfirmOrCancel" property must be truthy components.schemas.PaymentAmountForConfirmOrCancel
769:37 warning camara-properties-descriptions Property description is missing or empty: "PaymentAmountForConfirmOrCancel.description" property must be truthy components.schemas.PaymentAmountForConfirmOrCancel
784:25 warning camara-properties-descriptions Property description is missing or empty: "ChargingInformation" property must be truthy components.schemas.ChargingInformation
784:25 warning camara-properties-descriptions Property description is missing or empty: "ChargingInformation.description" property must be truthy components.schemas.ChargingInformation
800:22 warning camara-properties-descriptions Property description is missing or empty: "ChargingMetaData" property must be truthy components.schemas.ChargingMetaData
800:22 warning camara-properties-descriptions Property description is missing or empty: "ChargingMetaData.description" property must be truthy components.schemas.ChargingMetaData
826:15 warning camara-properties-descriptions Property description is missing or empty: "ErrorInfo.description" property must be truthy components.schemas.ErrorInfo
891:21 error oas3-valid-media-example "status" property type must be string components.responses.Generic400.content.application/json.example.status
901:22 error oas3-valid-media-example "status" property type must be string components.responses.Generic401.content.application/json.example.status
911:21 error oas3-valid-media-example "status" property type must be string components.responses.Generic403.content.application/json.example.status
921:22 error oas3-valid-media-example "status" property type must be string components.responses.Generic404.content.application/json.example.status
931:21 error oas3-valid-media-example "status" property type must be string components.responses.Generic500.content.application/json.example.status
941:21 error oas3-valid-media-example "status" property type must be string components.responses.Generic503.content.application/json.example.status
951:21 error oas3-valid-media-example "status" property type must be string components.responses.Generic504.content.application/json.example.status
995:29 warning camara-properties-descriptions Property description is missing or empty: "oAuth2ClientCredentials.description" property must be truthy components.securitySchemes.oAuth2ClientCredentials
995:29 error oas3-schema Invalid security scheme. components.securitySchemes.oAuth2ClientCredentials
997:13 error oas3-schema Property "flows" is not expected to be here. components.securitySchemes.oAuth2ClientCredentials.flows
999:21 error oas3-schema "tokenUrl" property must match format "uri-reference". components.securitySchemes.oAuth2ClientCredentials.flows.clientCredentials.tokenUrl
1001:15 warning camara-properties-descriptions Property description is missing or empty: "BasicAuth.description" property must be truthy components.securitySchemes.BasicAuth
1009:18 warning camara-properties-descriptions Property description is missing or empty: "three_legged.description" property must be truthy components.securitySchemes.three_legged

`

@PedroDiez
Copy link
Collaborator

PedroDiez commented Feb 7, 2024

The second one is due to Linter is checking all yaml files within the repo so i will adapt linter to only check the one in the code sub-folder repository

That means @rartych that linter rules work OK within Carrier Billing

@PedroDiez
Copy link
Collaborator

@rartych, @bigludo7

  • Will adapt linter in order to only check "yaml" within code subfolder
  • Will trigger new PR to adapt API Spec "format"

@PedroDiez
Copy link
Collaborator

PedroDiez commented Feb 8, 2024

@rartych checked again with the latest linter configuration in Commonalities and it is OK!!!!

https://github.com/PedroDiez/CarrierBillingCheckOut/actions/runs/7829282529/job/21360950171?pr=1

❌ Linted [YAML] files with [yamllint]: Found 1 error(s) - (0.52s) (expand for details)

  • Using [yamllint v1.32.0] https://megalinter.io/7.3.0/descriptors/yaml_yamllint
  • MegaLinter key: [YAML_YAMLLINT]
  • Rules config: [/github/workspace/.yamllint.yaml]
  • Number of files analyzed: [1]
    --Error detail:
    code/API_definitions/carrier_billing.yaml
    Error: 16:19 [trailing-spaces] trailing spaces
    Error: 19:26 [trailing-spaces] trailing spaces
    Error: 22:26 [trailing-spaces] trailing spaces
    Error: 28:1 [trailing-spaces] trailing spaces
    Error: 43:35 [trailing-spaces] trailing spaces
    Error: 55:1 [trailing-spaces] trailing spaces
    Error: 78:1 [trailing-spaces] trailing spaces
    Error: 135:11 [indentation] wrong indentation: expected 12 but found 10
    Error: 218:11 [indentation] wrong indentation: expected 12 but found 10
    Error: 223:22 [trailing-spaces] trailing spaces
    Error: 230:87 [trailing-spaces] trailing spaces
    Error: 234:135 [trailing-spaces] trailing spaces
    Error: 274:11 [indentation] wrong indentation: expected 12 but found 10
    Error: 317:11 [indentation] wrong indentation: expected 12 but found 10
    Error: 412:11 [indentation] wrong indentation: expected 12 but found 10
    Error: 471:11 [indentation] wrong indentation: expected 12 but found 10
    Error: 517:11 [indentation] wrong indentation: expected 12 but found 10
    Error: 988:29 [trailing-spaces] trailing spaces
    Error: 1176:54 [trailing-spaces] trailing spaces
    Error: 1317:21 [trailing-spaces] trailing spaces
    Error: 1401:123 [trailing-spaces] trailing spaces
    Error: 1417:48 [trailing-spaces] trailing spaces
    Error: 1450:123 [trailing-spaces] trailing spaces
    Error: 1475:1 [trailing-spaces] trailing spaces
    Error: 1671:32 [trailing-spaces] trailing spaces
    Error: 1680:16 [trailing-spaces] trailing spaces
    Error: 1687:24 [trailing-spaces] trailing spaces

Just format topics, for them I will trigger PR

cc @bigludo7

@PedroDiez
Copy link
Collaborator

After latest linter test, all is working successfully: PedroDiez#1

cc @rartych, @bigludo7

So that configuration is working for Carrier Billing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
subproject management Actions related to repository/releases
Projects
None yet
2 participants