camaraproject / CarrierBillingCheckOut

Repository to describe, develop, document and test the Carrier Billing Check Out API family
Apache License 2.0
9 stars 9 forks source link

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

Closed bigludo7 closed 4 months ago

bigludo7 commented 6 months ago

Problem description Implement use of linting rule set for Carrier Billing API. what we have to do is well documented in Commonalities: https://github.com/camaraproject/Commonalities/pull/110 https://github.com/camaraproject/Commonalities/pull/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.

PedroDiez commented 5 months ago

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 https://github.com/camaraproject/CarrierBillingCheckOut/pull/134 to deal with them

PedroDiez commented 5 months ago

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

PedroDiez commented 5 months ago

Considerations/Feedback:

PedroDiez commented 5 months ago

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

PedroDiez commented 5 months ago

Linter according to 31/JAN config applied: https://github.com/camaraproject/Commonalities/commit/29e4e9da8b8ca7dd0e435fb8a942ac4ba3952b59

Pending to check output:

https://github.com/PedroDiez/CarrierBillingCheckOut/actions/runs/7759600592/job/21163998825?pr=1

PedroDiez commented 4 months ago

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

PedroDiez commented 4 months ago

Tested linter again:

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 commented 4 months ago

` [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 commented 4 months ago

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 commented 4 months ago

@rartych, @bigludo7

PedroDiez commented 4 months ago

@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)

Just format topics, for them I will trigger PR

cc @bigludo7

PedroDiez commented 4 months ago

After latest linter test, all is working successfully: https://github.com/PedroDiez/CarrierBillingCheckOut/pull/1

cc @rartych, @bigludo7

So that configuration is working for Carrier Billing