Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 0 additions & 44 deletions tools/spectral/ipa/rulesets/IPA-117.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -264,50 +264,6 @@ rules:
- '#OperationObject.summary'
then:
function: 'IPA117OperationSummaryFormat'
functionOptions:
ignoreList:
- 'ID'
- 'IDs'
- 'MongoDB'
- 'OpenAPI'
- 'API'
- 'AI'
- 'AWS'
- 'GCP'
- 'IP'
- 'CIDR'
- 'DNS'
- 'LDAP'
- 'OIDC'
- 'JWKS'
- 'X.509'
- 'M2'
- 'M5'
- 'RAM'
- 'LTS'
- 'MCP'
- 'VPC'
- 'DN'
- 'CSV'
grammaticalWords:
- 'and'
- 'or'
- 'to'
- 'in'
- 'as'
- 'for'
- 'of'
- 'with'
- 'by'
- 'but'
- 'the'
- 'a'
- 'an'
- 'from'
- 'at'
- 'into'
- 'via'
- 'on'
xgen-IPA-117-get-operation-summary-starts-with:
description: |
In operation summaries, use 'Return' instead of 'Get' or 'List'. For example "Return One Identity Provider".
Expand Down
28 changes: 1 addition & 27 deletions tools/spectral/ipa/rulesets/IPA-126.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rules:

##### Implementation details
Rule checks for the following conditions:
- All tag names defined in the OpenAPI tags object should use Title Case
- All tag names defined in the OpenAPI tags object should use Title Case
- Title Case means each word starts with an uppercase letter, and the rest are lowercase
- Certain abbreviations (like "API", "AWS", etc.) in the ignoreList are allowed to maintain their casing
- Grammatical words (like "and", "or", "the", etc.) are allowed to be all lowercase
Expand All @@ -24,29 +24,3 @@ rules:
given: $.tags[?(@.name && @.name.length > 0)]
then:
function: 'IPA126TagNamesShouldUseTitleCase'
functionOptions:
ignoreList:
- 'AI'
- 'AWS'
- 'DNS'
- 'API'
- 'IP'
- 'MCP'
- 'MongoDB'
- 'LDAP'
- 'GCP'
- 'OpenAPI'
grammaticalWords:
- 'and'
- 'or'
- 'to'
- 'in'
- 'as'
- 'for'
- 'of'
- 'with'
- 'by'
- 'but'
- 'the'
- 'a'
- 'an'
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { evaluateAndCollectAdoptionStatus, handleInternalError } from './utils/collectionUtils.js';
import { isTitleCase } from './utils/casing.js';
import { resolveObject } from './utils/componentUtils.js';
import { IPA_117_GRAMMATICAL_WORDS, IPA_117_IGNORE_LIST } from './utils/grammaticalWordsAndIgnoreList.js';

export default (input, { ignoreList, grammaticalWords }, { path, rule, documentInventory }) => {
export default (input, options, { path, rule, documentInventory }) => {
const operationObjectPath = path.slice(0, -1);
const operationObject = resolveObject(documentInventory.resolved, operationObjectPath);
const errors = checkViolationsAndReturnErrors(input, ignoreList, grammaticalWords, operationObjectPath, rule.name);
const errors = checkViolationsAndReturnErrors(input, operationObjectPath, rule.name);
return evaluateAndCollectAdoptionStatus(errors, rule.name, operationObject, operationObjectPath);
};

function checkViolationsAndReturnErrors(summary, ignoreList, grammaticalWords, path, ruleName) {
function checkViolationsAndReturnErrors(summary, path, ruleName) {
try {
if (!isTitleCase(summary, ignoreList, grammaticalWords)) {
if (!isTitleCase(summary, IPA_117_IGNORE_LIST, IPA_117_GRAMMATICAL_WORDS)) {
return [
{
path,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { evaluateAndCollectAdoptionStatus } from './utils/collectionUtils.js';
import { isTitleCase } from './utils/casing.js';
import { IPA_126_GRAMMATICAL_WORDS, IPA_126_IGNORE_LIST } from './utils/grammaticalWordsAndIgnoreList.js';

export default (input, { ignoreList, grammaticalWords }, { path, rule }) => {
export default (input, options, { path, rule }) => {
const ruleName = rule.name;
const tagName = input.name;

// Check if the tag name uses Title Case
let errors = [];
if (!isTitleCase(tagName, ignoreList, grammaticalWords)) {
if (!isTitleCase(tagName, IPA_126_IGNORE_LIST, IPA_126_GRAMMATICAL_WORDS)) {
errors = [
{
path,
Expand Down
Loading
Loading