Skip to content

Conversation

@lovisaberggren
Copy link
Collaborator

@lovisaberggren lovisaberggren commented Mar 21, 2025

Proposed changes

Adds IPA rules xgen-IPA-117-description-starts-with-uppercase and xgen-IPA-117-description-ends-with-period.

xgen-IPA-117-description-ends-with-period will ignore descriptions ending with | as some descriptions have inline tables.

~20 violations for components and rule xgen-IPA-117-description-ends-with-period that were not caught with the legacy rule. Will go and fix these after merge (exceptions shouldn't be needed).

Jira ticket: CLOUDP-304967

@lovisaberggren lovisaberggren marked this pull request as ready for review March 21, 2025 17:16
@lovisaberggren lovisaberggren requested a review from a team as a code owner March 21, 2025 17:16

function checkViolationsAndReturnErrors(description, path) {
const upperCaseStart = new RegExp(`^[A-Z]`);
const periodEnd = new RegExp(`[.]$`);
Copy link
Contributor

Choose a reason for hiding this comment

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

you need to consider the old case https://github.com/mongodb/openapi/blob/3915e0a1a921c00e2ccdb30a37e8b0b8a2120f5f/tools/spectral/.spectral.yaml#L56C10-L56C27 a lot of descriptions end with a markdown table |

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah thanks for pointing it out. We have another guideline to not allow inline tables, so perhaps in this case if it ends with a table we should ignore rather than say it's adopted

Copy link
Collaborator

Choose a reason for hiding this comment

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

There's another IPA guideline stating (and there will be another validation rule for) Descriptions should not include inline tables, as this may not work well with all tools, particularly generated client code. Should we consider descriptions ending with Markdown tables valid?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah that's what I was thinking, so for this rule instead of saying . and | is valid, we can ignore cases where it ends with | and not collect adoption

Copy link
Collaborator

Choose a reason for hiding this comment

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

I saw your comment after updating the page, sorry :D I am okay with ignoring them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

NP! Will update 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Split them into two separate rules, and for the full stop test ignoring inline table endings

- '$.components.parameters[*]'
then:
function: 'IPA117HasDescription'
xgen-IPA-117-description-starts-with-uppercase:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Q: Can't we merge them into same rule as you did before, and giving inline table marks as functionOptions

Copy link
Member

@wtrocki wtrocki Mar 21, 2025

Choose a reason for hiding this comment

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

+1.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Was thinking about it initially though I didn't want to skip validating that the first letter is uppercase because it ends with |, so I split them into two to have clearer logic in the validator. Though we could add this as a function option for the description-ends-with-period, wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

Good context. Based on your explanation current state in PR SGTM

Copy link
Collaborator

@yelizhenden-mdb yelizhenden-mdb left a comment

Choose a reason for hiding this comment

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

LGTM

@lovisaberggren lovisaberggren merged commit 2510427 into main Mar 24, 2025
8 checks passed
@lovisaberggren lovisaberggren deleted the CLOUDP-304967 branch March 24, 2025 15:23
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