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.

5 changes: 5 additions & 0 deletions tools/spectral/ipa/ipa-spectral.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,8 @@ overrides:
rules:
xgen-IPA-107-operation-id-length: 'off'
xgen-IPA-107-valid-operation-id: 'off'
- files:
- '**#/tags/63'
- '**#/tags/62'
rules:
xgen-IPA-126-tag-names-should-use-title-case: 'off'
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
26 changes: 0 additions & 26 deletions tools/spectral/ipa/rulesets/IPA-126.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 { GRAMMATICAL_WORDS, IGNORE_LIST } from './utils/grammaticalWordsAndIgnoreList.js';

export default (input, { ignoreList, grammaticalWords }, { path, rule, documentInventory }) => {
export default (input, _, { 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, IGNORE_LIST, 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 { GRAMMATICAL_WORDS, IGNORE_LIST } from './utils/grammaticalWordsAndIgnoreList.js';

export default (input, { ignoreList, grammaticalWords }, { path, rule }) => {
export default (input, _, { 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, IGNORE_LIST, GRAMMATICAL_WORDS)) {
errors = [
{
path,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Shared configuration for title case validation lists used across IPA-126 and IPA-117 rules.
* These lists are used by the isTitleCase() function to validate proper title casing.
*/

export const IGNORE_LIST = [
'AI',
'API',
'AWS',
'CIDR',
'CSV',
'DN',
'DNS',
'GCP',
'ID',
'IDs',
'IP',
'JWKS',
'LDAP',
'LTS',
'M2',
'M5',
'MCP',
'MongoDB',
'OIDC',
'OpenAPI',
'RAM',
'VPC',
'X.509',
];

export const GRAMMATICAL_WORDS = [
'a',
'an',
'and',
'as',
'at',
'but',
'by',
'for',
'from',
'in',
'into',
'of',
'on',
'or',
'the',
'to',
'via',
'with',
];
Loading