# harvested from https://github.com/spliceforms/stoplight-projects/blob/efa3a9d27fea181247794c461dccb33010a2e51d/sf-style-guide/.spectral.json on 2026-10-09 — a Spectral ruleset published in the provider's own GitHub repository (spliceforms/stoplight-projects); found by GitHub code search, fetched verbatim and converted from JSON to YAML x-method: harvested x-stamped: 2026-10-09 x-source-url: https://github.com/spliceforms/stoplight-projects/blob/efa3a9d27fea181247794c461dccb33010a2e51d/sf-style-guide/.spectral.json description: '' formats: - oas2 - oas3 - oas3.0 - oas3.1 aliases: sf_All_Properties: description: All properties across all the models definitions/schemas targets: - formats: - oas3 given: - $..properties[*] - $..[?(@.type == 'integer')] - $..[?(@.type == 'string')] - $..[?(@.type == 'number')] sf_All_Number_Properties: description: All properties of type 'number' targets: - formats: - oas3 given: - $..properties[?(@.type == 'number')] - $..[?(@.type == 'number')] sf_All_Integer_Properties: description: All properties of type 'integer' targets: - formats: - oas3 given: - $..properties[?(@.type == 'integer')] - $..[?(@.type == 'integer')] sf_All_Models: description: 'All models definitions/schemas ' targets: - formats: - oas3 given: - $.components.schemas.* sf_All_Response_Schemas: description: All models definitions/schemas specified in all the operation responses targets: - formats: - oas3 given: - $..paths.*.*.responses.*.content.*.schema - $..responses..schema sf_All_Response_Header_Names: description: Names of all the headers returned in all the API operation responses targets: - formats: - oas3 given: - $..responses..headers.*~ sf_All_Property_Names: description: Names of all the properties across all the model definitions/schemas targets: - formats: - oas3 given: - $..properties[*]~ sf_All_Response_MediaTypes: description: 'Media types used in the API operation responses ' targets: - formats: - oas3 given: - '#Operation_Responses...content.*~' sf_All_Object_Properties: description: 'All properties of type ''object'' ' targets: - formats: - oas3 given: - $..properties[?(@.type == 'object' && !@.additionalProperties)] sf_All_Array_Items_Properties: description: Targets the 'items' property in all the array type of properties targets: - formats: - oas3 given: - $..[?(@ && @.type=='array')].items.type sf_All_Model_Names: description: The names of all model definitions/schemas targets: - formats: - oas3 given: - $.components.schemas.*~ sf_All_Model_Required_Field: description: '' targets: - formats: - oas3 given: - $.components.schemas sf_All_Enum: description: '' targets: - formats: - oas3 given: - $.components.schemas.*.properties.* sf_Object_Properties: description: '' targets: - formats: - oas3 given: - $.components.schemas[?(@.type=='object' && !@.oneOf && !@.anyOf && !@.allOf)] - $..schema[?(@.type=='object' && !@.oneOf && !@.anyOf && !@.allOf)] sf_All_Date_Properties: description: '' targets: - formats: - oas3 given: - $.components.schemas..properties[?(@.type == 'string' && @.format == 'date-time')] sf_Response_4XX-5XX_Ref: description: '' targets: - formats: - oas3 given: - $.paths[*][*].responses[?(@property >= 400 && @property < 600 && @.content && @.content["application/json"] && (!@.content["application/json"].schema.$ref || @.content["application/json"].schema.$ref != './models/ProblemJson.yaml'))] sf_Problem_Json_Model: description: '' targets: - formats: - oas3 given: - $.components.schemas.ProblemJson sf_All_None_Ref_Properties: description: '' targets: - formats: - oas3 given: - $..properties[?(!(@.$ref) && !(@.oneOf) && !(@.allOf) && !(@.anyOf))] sf_all_ref: description: '' targets: - formats: - oas3.0 given: - $..$ref sf_All_String_Properties: description: '' targets: - formats: - oas3 given: - $..properties[?(@.type == 'string')] - $..[?(@.type == 'string')] sf_All_String_Properties_Exclude_Enum: description: '' targets: - formats: - oas3 given: - $..[?(@.type == 'string' && !@.enum && @.format != 'date' && @.format != 'date-time')] sf_All_Ref_Properties: description: '' targets: - formats: - oas3 given: - $.components.schemas..properties[?(@.$ref && !@.description && !@.type)] All_Array_Item: description: '' targets: - formats: - oas2 given: - $..[?(@ && @.type=='array')] - formats: - oas3 given: - $..[?(@ && @.type=='array')] - formats: - oas3.0 given: - $..[?(@ && @.type=='array')] - $..[?(@ && @.type && @.type.constructor.name === 'Array' && @.type.includes('array'))] All_Enum_Object: description: All references throughout the API targets: - formats: - oas2 given: - $..[?(@ && @.enum)] - formats: - oas3 given: - $..[?(@ && @.enum)] All_Enum_Value: description: All enum values throughout the API targets: - formats: - oas2 given: - $..[?(@ && @.enum)].enum[*] - formats: - oas3 given: - $..[?(@ && @.enum)].enum[*] All_Example: description: All examples across the API document targets: - formats: - oas2 given: - $..examples[*] - formats: - oas3 given: - $.components.examples[*] - $.paths[*][*]..content[*].examples[*] - $.paths[*][*]..parameters[*].examples[*] - $.components.parameters[*].examples[*] - $.paths[*][*]..headers[*].examples[*] - $.components.headers[*].examples[*] All_Example_Media: description: All examples for schemas targets: - formats: - oas2 given: - $..responses..[?(@ && @.schema && @.examples)] - formats: - oas3 given: - $..content..[?(@ && @.schema && (@.example !== void 0 || @.examples))] - $..headers..[?(@ && @.schema && (@.example !== void 0 || @.examples))] - $..parameters..[?(@ && @.schema && (@.example !== void 0 || @.examples))] All_Example_Schema: description: All examples for schemas targets: - formats: - oas2 given: - $..definitions..[?(@property !== 'properties' && @ && (@.example !== void 0 || @['x-example'] !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))] - $..parameters..[?(@property !== 'properties' && @ && (@.example !== void 0 || @['x-example'] !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))] - $..responses..[?(@property !== 'properties' && @ && (@.example !== void 0 || @['x-example'] !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))] - formats: - oas3 given: - $.components.schemas..[?(@property !== 'properties' && @ && (@ && @.example !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))] - $..content..[?(@property !== 'properties' && @ && (@ && @.example !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))] - $..headers..[?(@property !== 'properties' && @ && (@ && @.example !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))] - $..parameters..[?(@property !== 'properties' && @ && (@ && @.example !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))] All_Markdown: description: All markdown descriptions across the document. targets: - formats: - oas2 given: - $..[description,title] - formats: - oas3 given: - $..[description,title] All_Ref: description: All references throughout the API targets: - formats: - oas2 given: - $..[?(@property === '$ref')] - formats: - oas3 given: - $..[?(@property === '$ref')] All_Servers: description: API hosts defined in the API specification targets: - formats: - oas3 given: - $.servers[*] - '#Path_Item.servers[*]' - '#Operation_Object.servers[*]' - '#Link_Object.server' - formats: - oas2 given: - $.host API_Contact: description: The top level description in an API document targets: - formats: - oas2 given: - $.info.contact - formats: - oas3 given: - $.info.contact API_Description: description: The top level description in an API document targets: - formats: - oas2 given: - $.info.description - formats: - oas3 given: - $.info.description API_Document: description: 'The complete API specification document. This can be used to target any part of the OpenAPI document using **field**. *Use this if you don''t find specific targets that cater to your usecase.* ' targets: - formats: - oas2 given: - $ - formats: - oas3 given: - $ API_Document_RecursiveSearch: description: 'The complete API specification document. This can be used to target any part of the OpenAPI document using **field**. *Use this if you don''t find specific targets that cater to your usecase.* ' targets: - formats: - oas2 given: - $.. - formats: - oas3 given: - $.. API_License: description: The top level description in an API document targets: - formats: - oas2 given: - $.info.license - formats: - oas3 given: - $.info.license API_Server: description: API hosts defined in the API specification targets: - formats: - oas3 given: - $.servers - formats: - oas2 given: - $.host API_Server_URL: description: API host urls defined in the API specification targets: - formats: - oas3 given: - $.servers[*].url - formats: - oas2 given: - $.host API_Tags: description: Tags on an API object targets: - formats: - oas2 given: - '#Operation_Object.tags' - formats: - oas3 given: - '#Operation_Object.tags' API_Tags_Item: description: Tags on an API object targets: - formats: - oas2 given: - $.tags[*] - formats: - oas3 given: - $.tags[*] Link_Object: description: '' targets: - formats: - oas3 given: - $.components.links[*] - '#Response_All_Object.links[*]' Operation_Object: description: The complete operation object. Use it in combo with field object. targets: - formats: - oas2 given: - '#Path_Item[get,put,post,delete,options,head,patch,trace]' - formats: - oas3 given: - '#Path_Item[get,put,post,delete,options,head,patch,trace]' Operation_Responses: description: Responses for all operations including get, put, post, delete, options, head, patch, trace. targets: - formats: - oas2 given: - '#Operation_Object.responses' - formats: - oas3 given: - '#Operation_Object.responses' Path_Item: description: '' targets: - formats: - oas2 given: - $.paths[*] - formats: - oas3 given: - $.paths[*] Path_Object: description: Path object. Usually used to target the Path key e.g. `/users/{userId}` targets: - formats: - oas2 given: - $.paths - formats: - oas3 given: - $.paths Request_Parameter_All: description: All request parameters targets: - formats: - oas2 given: - $..parameters[*] - formats: - oas3 given: - $..parameters[*] Request_Parameter_Cookie: description: All request cookie parameters targets: - formats: - oas2 given: - $..parameters[?(@ && @.in=="cookie")] - formats: - oas3 given: - $..parameters[?(@ && @.in=="cookie")] Request_Parameter_Header: description: All request header parameters targets: - formats: - oas2 given: - $..parameters[?(@ && @.in=="header")] - formats: - oas3 given: - $..parameters[?(@ && @.in=="header")] Request_Parameter_Path: description: All request path parameters targets: - formats: - oas2 given: - $..parameters[?(@ && @.in=="path")] - formats: - oas3 given: - $..parameters[?(@ && @.in=="path")] Request_Parameter_Query: description: All request query parameters targets: - formats: - oas2 given: - $..parameters[?(@ && @.in=="query")] - formats: - oas3 given: - $..parameters[?(@ && @.in=="query")] Response_All_Object: description: All responses (object) in an API targets: - formats: - oas2 given: - $.responses - '#Operation_Responses' - $..responses - formats: - oas3 given: - $.components.responses - '#Operation_Responses' - $..responses rules: sf_model-description: given: - '#sf_All_Models' severity: error then: function: truthy field: description description: "**Model description must be present and non-empty string.**\n\n\ - Each Model in your schema must include a `description` field.\n- The `description`\ \ field must be a non-empty string.\n\n#### Valid Example\n\n```json\n\"UserProfile\"\ : {\n \"type\": \"object\",\n \"description\": \"Represents a user's profile\ \ information.\",\n \"properties\": {\n \"name\": {\n \"\ type\": \"string\"\n }\n }\n }\n```\n#### Invalid Example\n\n```json\n\ \"UserProfile\": {\n \"type\": \"object\",\n \"properties\": {\n \ \ \"name\": {\n \"type\": \"string\"\n }\n }\n }\n```" message: Definition description must be present and non-empty string resolved: true formats: - oas3 sf_operation-summary-formatted: given: - '#Operation_Object' severity: warn then: function: pattern functionOptions: match: ^[A-Z][\s\S]*\.$ field: summary description: "**Operation Summary Rules:**\n\n- Must start with an uppercase letter\n\ - Must end with a period (dot)\n\n#### Valid Examples\n```json\n{\n \"summary\"\ : \"Get user details.\"\n}\n```\n\n#### Invalid Examples\n```json\n{\n \"summary\"\ : \"get user details\"\n}\n```\n" message: Operation summary must start with upper case and end with a dot sf_property-description: given: - '#sf_All_None_Ref_Properties' severity: error then: function: truthy field: description description: "**Property description must be present and non-empty string.**\n\ \n\n- Each Property in your schema must include a `description` field.\n- The\ \ `description` field must be a non-empty string.\n\n#### Valid Example\n\n\ ```json\n\"User\": {\n \"type\": \"object\",\n \"properties\": {\n \ \ \"username\": {\n \"type\": \"string\",\n \"description\"\ : \"The username of the user.\"\n },\n \"age\": {\n \"\ type\": \"integer\",\n \"description\": \"The age of the user.\"\n\ \ }\n }\n}\n```\n#### Invalid Example\n```json\n\"User\": {\n \"\ type\": \"object\",\n \"properties\": {\n \"username\": {\n \ \ \"type\": \"string\",\n },\n \"age\": {\n \"type\"\ : \"integer\",\n \"description\": \"\"\n }\n }\n}\n```" message: 'Property description must be present and non-empty string. ' sf_definition-name-upper-camel-case: given: - '#sf_All_Model_Names' severity: error then: function: pattern functionOptions: match: ^[A-Z][a-zA-Z0-9]*$ description: "**Definition names must be in Upper CamelCase:**\n\n- Examples of\ \ valid names: `Account`, `UserProfile`, `OrderDetails`, `ProductID`\n- Examples\ \ of invalid names: `account`, `userProfile`, `order_details`, `productid`\n\ \n#### Valid Json\n```json\n\"Account\": {\n \"type\": \"object\",\n \"\ properties\": {\n \"accountNumber\": {\n \"type\": \"string\"\ ,\n \"description\": \"Account number.\"\n },\n }\n}\n```\n\ \n#### Invalid Json\n```json\n\"account\": {\n \"type\": \"object\",\n \ \ \"properties\": {\n \"accountNumber\": {\n \"type\": \"string\"\ ,\n \"description\": \"Account number.\"\n },\n }\n}\n```" message: 'The definition names must be in the upper CamelCase: ^[A-Z][a-zA-Z0-9]*$' sf_string-property-example: given: - '#sf_All_String_Properties' severity: error then: function: schema functionOptions: schema: oneOf: - required: - example - required: - examples description: "**String properties must have an `example` field:**\n\nEvery string\ \ property in your schema must include an `example` field to provide sample\ \ values.\n\n#### Json Example:\n\n```json\n{\n \"type\": \"object\",\n \"\ properties\": {\n \"username\": {\n \"type\": \"string\",\n \"\ example\": \"john_doe\"\n },\n \"email\": {\n \"type\": \"string\"\ ,\n \"example\": \"john.doe@example.com\"\n }\n }\n}\n" message: String properties must include either an `example` or `examples` field. sf_request-header-hyphenated-upper-camel-case: given: - '#Request_Parameter_Header' severity: error then: function: pattern functionOptions: match: ^([A-Z][a-z0-9]*)(-([A-Z][a-z0-9]*))*$ field: name description: "**HTTP Header Fields in request Must Be in Hyphenated-Upper-Camel-Case**\n\ \nHTTP header fields in request parameters should be formatted using Hyphenated-Upper-Camel-Case.\ \ This means each word starts with an uppercase letter and is separated by hyphens.\n\ \n#### Valid Examples\n```json\n{\n \"headers\": {\n \"X-Api-Key\"\ : \"123456\",\n \"User-Agent\": \"MyApp/1.0\"\n }\n}\n```\n#### Invalid\ \ Examples\n```json\n{\n \"headers\": {\n \"x-api-key\": \"123456\"\ , // should be \"X-Api-Key\"\n \"user-agent\": \"MyApp/1.0\" // should\ \ be \"User-Agent\"\n }\n}\n``" message: HTTP Header fields in request parameters must be in Hyphenated-Upper-Camel-Case sf_string-property-pattern: given: - '#sf_All_String_Properties_Exclude_Enum' severity: error then: function: truthy field: pattern description: "**The 'Pattern' property must be present and non-empty for string\ \ properties**\n\nFor string properties in your schema, the `Pattern` property\ \ must be specified and must not be an empty string. This ensures that the string\ \ values conform to the expected format.\n\n#### Valid Example\n\n```json\n\ {\n \"type\": \"object\",\n \"properties\": {\n \"username\": {\n\ \ \"type\": \"string\",\n \"pattern\": \"^[a-zA-Z0-9_]+$\"\ \n }\n }\n}\n```\n\n#### Invalid Example\n\n```json\n{\n \"type\"\ : \"object\",\n \"properties\": {\n \"username\": {\n \"\ type\": \"string\",\n \"pattern\": \"\"\n }\n \"email\"\ : {\n \"type\": \"string\"\n }\n }\n}\n```\n" message: The 'Pattern' must be present for a string property and non-empty sf_path-segment-name-lower-camel-case: given: - '#Request_Parameter_Path' severity: error then: function: pattern functionOptions: match: ^[a-z][a-zA-Z0-9]*$ field: name description: "**Path segments (parameters) must be in lower camel case:**\n\n\ - Path parameters should be written in lower camel case format. This means the\ \ first letter should be lowercase, and subsequent words should start with an\ \ uppercase letter.\n- Examples of valid names: `userId`, `orderNumber`, `productCode`\n\ - Examples of invalid names: `UserID`, `order_number`, `PRODUCTCODE`\n\n####\ \ Valid Example\n```json\n\"/users/{userId}\": {\n \"get\": {\n \ \ \"parameters\": [\n {\n \"name\": \"userId\",\n \ \ \"in\": \"path\",\n \"required\": true,\n \"schema\"\ : {\n \"type\": \"string\"\n }\n }\n \ \ ]\n }\n }\n```\n#### Invalid Example\n```json\n\"/products/{PRODUCTCODE}\"\ : {\n \"get\": {\n \"parameters\": [\n {\n \"\ name\": \"PRODUCTCODE\",\n \"in\": \"path\",\n \"required\"\ : true,\n \"schema\": {\n \"type\": \"string\"\n \ \ }\n }\n ]\n }\n }\n```\n\n\n" message: 'Path segments (parameters) must be in lower camel case: ^[a-z][a-zA-Z0-9]*$' sf_property-name-lower-camel-case: given: - '#sf_All_Property_Names' severity: error then: function: pattern functionOptions: match: ^[a-z][a-zA-Z0-9]*$ description: "**Property names must be in lower camel case:**\n\n- Examples of\ \ valid names: `userName`, `orderId`, `productCode`\n- Examples of invalid names:\ \ `UserName`, `order_id`, `ProductCode`\n\n#### Json Example:\n\n```json\n{\n\ \ \"userName\": \"JohnDoe\",\n \"orderId\": \"12345\",\n \"productCode\"\ : \"XYZ789\"\n}\n```\n" message: 'Property names must be in lower camel case: ^[a-z][a-zA-Z0-9]*$' sf_query-parameter-name-lower-camel-case: given: - '#Request_Parameter_Query' severity: error then: function: pattern functionOptions: match: ^[a-z][a-zA-Z0-9]*$ field: name description: "**Query parameter names must be in lower camel case:**\n\n- Examples\ \ of valid names: `userId`, `orderNumber`, `productName`\n- Examples of invalid\ \ names: `UserId`, `order_number`, `ProductName`\n\n#### JSON Example:\n\n```json\n\ {\n \"parameters\": [\n {\n \"name\": \"userId\",\n \"in\": \"\ query\",\n \"required\": true,\n \"schema\": {\n \"type\":\ \ \"string\"\n }\n },\n {\n \"name\": \"orderNumber\",\n \ \ \"in\": \"query\",\n \"required\": true,\n \"schema\": {\n \ \ \"type\": \"string\"\n }\n }\n ]\n}\n```" message: 'Query parameter names must be in lower camel case: ^[a-z][a-zA-Z0-9]*$' sf_response-header-hyphenated-upper-camel-case: given: - '#sf_All_Response_Header_Names' severity: error then: function: pattern functionOptions: match: ^([A-Z][a-z0-9]*)(-([A-Z][a-z0-9]*))*$ description: "**HTTP Header Fields in Response Must Be in Hyphenated-Upper-Camel-Case**\n\ \nHTTP header fields in response parameters should be formatted using Hyphenated-Upper-Camel-Case.\ \ This means each word starts with an uppercase letter and is separated by hyphens.\n\ \n#### Valid Examples\n```json\n{\n \"headers\": {\n \"X-Api-Key\"\ : \"123456\"\n }\n}\n```\n#### Invalid Examples\n```json\n{\n \"headers\"\ : {\n \"x-api-key\": \"123456\" // should be \"X-Api-Key\"\n }\n}\n\ ``" message: HTTP Header fields in response must be in Hyphenated-Upper-Camel-Case sf_definition-type: given: - '#sf_All_Models' severity: error then: function: schema functionOptions: schema: anyOf: - required: - type - required: - oneOf - required: - anyOf - required: - allOf allErrors: false description: "**Model Definitions must have a type**\n\nAll model definitions\ \ must include a `type` property to specify the type of the model.\n\n#### JSON\ \ Example:\n\n```json\n\"User\": {\n \"type\": \"object\",\n \"properties\"\ : {\n \"id\": {\n \"type\": \"integer\"\n },\n \"name\"\ : {\n \"type\": \"string\"\n }\n }\n}\n```" message: Model Definitions must have a `type` field or at least one of `oneOf`, `anyOf`, or `allOf`. sf_integer-property-min-max: given: - '#sf_All_Integer_Properties' severity: error then: - function: defined field: maximum - function: defined field: minimum - function: undefined field: exclusiveMinimum - function: undefined field: exclusiveMaximum description: "**An integer property must include minimum and maximum constraints\ \ but must not have exclusiveMinimum or exclusiveMaximum constraints.**\n\n\ Every integer property in your schema must include the following constraints:\n\ \n- `minimum`: The minimum value the integer can take.\n- `maximum`: The maximum\ \ value the integer can take.\n\n\n#### Json Example:\n\n```json\n{\n \"type\"\ : \"object\",\n \"properties\": {\n \"age\": {\n \"type\": \"integer\"\ ,\n \"minimum\": 0,\n \"maximum\": 100,\n \"exclusiveMinimum\"\ : false,\n \"exclusiveMaximum\": false\n },\n \"score\": {\n \ \ \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 10,\n \ \ \"exclusiveMinimum\": false,\n \"exclusiveMaximum\": false\n }\n\ \ }\n}\n" message: An integer property must include minimum and maximum constraints but must not have exclusiveMinimum or exclusiveMaximum constraints. sf_property-format-for-integer: given: - '#sf_All_Integer_Properties' severity: error then: - function: truthy field: format - function: pattern functionOptions: match: ^int(32|64)$ field: format description: "**Integer properties must have a format and should be either `int32`\ \ or `int64`:**\n\n**Formats:**\n - `int32`: A 32-bit signed integer.\n -\ \ `int64`: A 64-bit signed integer.\n\n#### Valid Examples\n```json\n{\n \ \ \"exampleInt32\": {\n \"type\": \"integer\",\n \"format\": \"int32\"\ \n },\n \"exampleInt64\": {\n \"type\": \"integer\",\n \"format\"\ : \"int64\"\n }\n }\n```\n\n#### Invalid Examples\n```json\n {\n \"exampleIntInvalid\"\ : {\n \"type\": \"integer\",\n \"format\": \"int16\"\n },\n \"anotherInvalidInt\"\ : {\n \"type\": \"integer\"\n }\n}\n```" message: Integer property must have a format and it should be either int32 or int64 sf_property-format-for-number: given: - '#sf_All_Number_Properties' severity: error then: function: falsy field: format description: "**Rule: The \"Number\" type of properties should not have a format\ \ attribute.**\n\nAll numbers are considered in the `BigDecimal` format.\n\n\ \n#### Valid JSON\n\n```json\n{\n \"example\": {\n \"type\": \"number\"\n\ \ // No format attribute present.\n }\n}\n```\n\n#### Invalid JSON\n\n```json\n\ {\n \"example\": {\n \"type\": \"number\",\n \"format\": \"float\" //\ \ Invalid: Number properties should not have a format attribute.\n }\n}\n```" message: The "Number" type of properties should not have a format attribute. All numbers are considered in the 'BigDecimal' format. sf_property-type: given: - '#sf_All_None_Ref_Properties' severity: error then: function: defined field: type description: "**Property must have a type**\n\n- Every property in your schema\ \ must have a defined type.\n\n#### Valid Examples\n```json\n{\n \"type\"\ : \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"\ string\"\n },\n \"age\": {\n \"type\": \"integer\"\n }\n\ \ },\n \"required\": [\"name\", \"age\"]\n }\n```\n\n#### Invalid Examples\n\ \ ```json\n {\n \"type\": \"object\",\n \"properties\": {\n \"\ name\": {\n \"type\": \"string\"\n },\n \"age\": {\n }\n\ \ },\n \"required\": [\"name\", \"age\"]\n }\n```\n\n" message: Property must have a type. sf_string-property-min-max: given: - '#sf_All_String_Properties_Exclude_Enum' severity: error then: - function: defined field: minLength - function: defined field: maxLength description: "**`minLength` and `maxLength` constraints must be present for string\ \ properties.**\n\n All string properties must have both `minLength` and `maxLength`\ \ constraints defined. This ensures that the length of the string values is\ \ appropriately restricted.\n\n#### Valid Examples\n```json\n{\n \"type\"\ : \"object\",\n \"properties\": {\n \"username\": {\n \"\ type\": \"string\",\n \"minLength\": 3,\n \"maxLength\": 20\n\ \ },\n \"password\": {\n \"type\": \"string\",\n \ \ \"minLength\": 8,\n \"maxLength\": 50\n }\n }\n}\n\ ```\n\n#### Invalid Examples\n```json\n{\n \"type\": \"object\",\n \"\ properties\": {\n \"username\": {\n \"type\": \"string\",\n\ \ \"maxLength\": 20\n },\n \"password\": {\n \ \ \"type\": \"string\"\n }\n }\n}\n```\n\n" message: minLength and maxLength constraints must be present for the string property sf_inline-model-ref: given: - '#sf_All_Object_Properties' severity: error then: function: schema functionOptions: schema: anyOf: - required: - $ref - not: required: - type description: "**Model must not contain another model inline. `#Ref` property should\ \ be used instead.**\n\nIn OpenAPI definitions, models should not contain other\ \ models directly inline. Instead, use the `$ref` property to reference other\ \ models.\n\n#### Json Example\n\n```json\n{\n \"components\": {\n \"schemas\"\ : {\n \"User\": {\n \"type\": \"object\",\n \"properties\"\ : {\n \"id\": {\n \"type\": \"string\"\n },\n \ \ \"profile\": {\n \"$ref\": \"#/components/schemas/Profile\"\ \n }\n }\n },\n \"Profile\": {\n \"type\":\ \ \"object\",\n \"properties\": {\n \"firstName\": {\n \ \ \"type\": \"string\"\n },\n \"lastName\": {\n \ \ \"type\": \"string\"\n }\n }\n }\n }\n }\n\ }\n" message: 'Model must not contain another model inline. #Ref property should be used instead' resolved: false sf_only-local-references: given: - '#sf_all_ref' severity: error then: function: pattern functionOptions: notMatch: '' match: ^#\\/components description: "**Only local schema references must be used.**\n\n All schema references\ \ should be local to the current document. External schema references are not\ \ allowed.\n\n#### Valid Example\n ```json\n {\n \"$ref\": \"#/components/schemas/User\"\ \n }\n ```\n#### Invalid Example\n ```json\n {\n \"$ref\": \"https://example.com/schemas/User\"\ \n }\n ```" message: 'Only local schema references must be used. ' resolved: true sf_number-property-example: given: - '#sf_All_Number_Properties' severity: error then: function: schema functionOptions: schema: oneOf: - required: - example - required: - examples description: "**Number property must have an `example`:**\n\nEach number property\ \ in your JSON schema must include an `example` field to provide a sample value.\ \ This ensures better documentation and understanding of the expected data format.\n\ \n #### Json Example \n\n```json\n{\n \"type\": \"object\",\n \"properties\"\ : {\n \"age\": {\n \"type\": \"number\",\n \"description\": \"\ The age of the person\",\n \"example\": 30\n },\n \"price\": {\n\ \ \"type\": \"number\",\n \"description\": \"The price of the item\"\ ,\n \"example\": 99.99\n }\n },\n \"required\": [\"age\", \"price\"\ ]\n}\n" message: Number properties must include either an `example` or `examples` field. sf_integer-property-example: given: - '#sf_All_Integer_Properties' severity: error then: function: schema functionOptions: schema: oneOf: - required: - example - required: - examples description: "**Integer property must have an `example`.**\n\nEach integer property\ \ in your API specification must include an `example` field to ensure clarity\ \ and consistency.\n\n#### Example JSON\n```json\n{\n \"type\": \"object\"\ ,\n \"properties\": {\n \"age\": {\n \"type\": \"integer\",\n \ \ \"example\": 30\n }\n }\n}\n```\n#### Valid Example\n```json\n{\n \"\ type\": \"integer\",\n \"example\": 123\n}\n```\n\n#### Invalid Example\n```json\n\ {\n \"type\": \"integer\"\n}\n```\n\n\n" message: Integer properties must include either an `example` or `examples` field. sf_model-required-field: given: - '#sf_All_Model_Required_Field' severity: warn then: function: sfRequiredFieldCheck description: "This rule ensures that an object model in your OpenAPI specification\ \ has at least one required field. Additionally, the specified required fields\ \ must be present in the `properties` of the object model.\n\n#### Valid Json\n\ \n```json\n{\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n\ \ \"type\": \"string\"\n },\n \"age\": {\n \"type\": \"integer\"\ \n }\n },\n \"required\": [\"name\"]\n}\n```\n\n#### Valid Json\n\n```json\n\ {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\"\ : \"string\"\n }\n },\n \"required\": [\"age\"]\n}\n```" message: 'Object model should have at least one required field and the mentioned fields should be present in the properties ' resolved: false sf_response-4XX-5XX-json-problem: given: - '#sf_Response_4XX-5XX_Ref' severity: error then: function: sfCheckJsonProblem description: "This rule ensures that all API responses with status codes in the\ \ 4XX or 5XX range (client and server errors) must return a ProblemJson model.\n\ \n#### Valid json\n\n```json\n{\n \"paths\": {\n \"/example\": {\n \ \ \"get\": {\n \"responses\": {\n \"500\": {\n \"\ description\": \"Internal Server Error\",\n \"content\": {\n \ \ \"application/json\": {\n \"schema\": {\n \ \ \"type\": \"object\",\n \"required\": [\"type\"\ , \"title\", \"status\"],\n \"properties\": {\n \ \ \"type\": {\n \"type\": \"string\",\n \ \ \"example\": \"https://example.com/error\"\n \ \ },\n \"title\": {\n \"type\":\ \ \"string\",\n \"example\": \"Internal Server Error\"\n\ \ },\n \"status\": {\n \ \ \"type\": \"integer\",\n \"format\": \"int32\"\ ,\n \"example\": 500\n },\n \ \ \"detail\": {\n \"type\": \"string\",\n \ \ \"example\": \"An unexpected error occurred.\"\n \ \ },\n \"instance\": {\n \ \ \"type\": \"string\",\n \"example\": \"/example/123\"\ \n }\n }\n }\n \ \ }\n }\n }\n }\n }\n }\n }\n}\n\n```\n\ \n#### Invalid json\n\n```json\n{\n \"paths\": {\n \"/example\": {\n \ \ \"get\": {\n \"responses\": {\n \"500\": {\n \ \ \"description\": \"Internal Server Error\"\n // Missing content.application/json\n\ \ }\n }\n }\n }\n }\n}\n\n{\n \"paths\": {\n \"\ /example\": {\n \"get\": {\n \"responses\": {\n \"500\"\ : {\n \"description\": \"Internal Server Error\",\n \"\ content\": {\n \"application/json\": {\n \"schema\"\ : {\n \"type\": \"object\",\n \"required\"\ : [\"type\", \"title\", \"status\"],\n \"properties\": {\n\ \ \"type\": {\n \"type\": \"string\"\ ,\n \"example\": \"https://example.com/error\"\n \ \ },\n \"title\": {\n \"\ type\": \"integer\", // Invalid type, should be string\n \ \ \"example\": 123\n },\n \"status\"\ : {\n \"type\": \"string\", // Invalid type, should be\ \ integer\n \"example\": \"500\"\n }\n\ \ }\n }\n }\n }\n \ \ }\n }\n }\n }\n }\n}\n\n```" message: Operation responses with status as 4XX or 5XX must return json problem resolved: false sf_string-property-enum-check: given: - '#sf_All_Enum' severity: error then: function: sfStringPropertiesEnumCheck description: "This rule validates that if a string property with an `enum` in\ \ a schema specifies `pattern`, `minLength`, or `maxLength`, the `enum` values\ \ must conform to these constraints.\n\n#### Valid Example\n```json\n{\n \"\ components\": {\n \"schemas\": {\n \"ExampleSchema\": {\n \"\ type\": \"object\",\n \"properties\": {\n \"validStringProperty\"\ : {\n \"type\": \"string\",\n \"enum\": [\n \ \ \"ABC123\",\n \"DEF456\"\n ],\n \"pattern\"\ : \"^[A-Z]{3}\\\\d{3}$\",\n \"minLength\": 6,\n \"maxLength\"\ : 6\n }\n }\n }\n }\n }\n}\n```\n\n#### Invalid Example\n\ ```json\n{\n \"components\": {\n \"schemas\": {\n \"ExampleSchema\"\ : {\n \"type\": \"object\",\n \"properties\": {\n \"\ invalidStringPropertyMinLength\": {\n \"type\": \"string\",\n \ \ \"enum\": [\n \"A1\",\n \"B2\"\n \ \ ],\n \"pattern\": \"^[A-Z]\\\\d$\",\n \"minLength\"\ : 3,\n \"maxLength\": 3\n }\n }\n }\n }\n\ \ }\n}\n\n```" message: '''pattern'', ''minLength'' & ''maxLength'' if specified, for String property with enum should be as per allowed list of enum values' sf-model-array-items-object-properties: given: - '#sf_All_Array_Items_Properties' severity: error then: function: pattern functionOptions: match: '' notMatch: ^object$ description: "This rule ensures that array items do not have an inline object\ \ definition. Instead, array items should refer to a defined object using `$ref`.\n\ \n#### Valid Json\n\n```json\n{\n \"components\": {\n \"schemas\": {\n \ \ \"MyArrayModel\": {\n \"type\": \"array\",\n \"items\":\ \ {\n \"$ref\": \"#/components/schemas/MyObjectModel\"\n }\n\ \ },\n \"MyObjectModel\": {\n \"type\": \"object\",\n \ \ \"properties\": {\n \"id\": {\n \"type\": \"string\"\ \n }\n }\n }\n }\n }\n}\n\n```\n\n#### Invalid Json\n\ \n```json\n{\n \"components\": {\n \"schemas\": {\n \"MyArrayModel\"\ : {\n \"type\": \"array\",\n \"items\": {\n \"type\"\ : \"object\",\n \"properties\": {\n \"id\": {\n \ \ \"type\": \"string\"\n }\n }\n }\n }\n\ \ }\n }\n}\n\n```\n" message: Array model should not have inline definition of the object. Use $ref instead. resolved: false sf_object-model-properties-required: given: - '#sf_Object_Properties' severity: error then: - function: length functionOptions: min: 1 field: properties - function: truthy field: properties description: "This rule ensures that object model definitions include a properties\ \ field and that this field contains at least one property.\n\n#### Valid Json\n\ \n```json\n{\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n\ \ \"type\": \"string\"\n },\n \"age\": {\n \"type\": \"integer\"\ \n }\n }\n}\n\n```\n\n#### Invalid Json\n\n```json\n{\n \"type\": \"object\"\ \n}\n\n```\n```json\n{\n \"type\": \"object\",\n \"properties\": {}\n}\n\n\ ```" message: Object model definition must have properties + there should be atleast one property sf_response-schema-json-object: given: - '#sf_All_Response_Schemas' severity: error then: function: pattern functionOptions: match: ^object$ field: type description: "Ensure that response schemas do not return primitive types (array,\ \ string, integer, number) directly. Instead, these types should be wrapped\ \ inside an object.\n\n\n#### Valid Json\n\n```json\n{\n \"type\": \"object\"\ ,\n \"properties\": {\n \"data\": {\n \"type\": \"string\"\n }\n\ \ }\n}\n\n```\n\n#### Invalid Json\n\n```json\n{\n \"type\": \"string\"\n\ }\n\n```" message: Response schema should not return array/string/integer/number in the response instead wrap it inside the object sf_string-date-property: given: - '#sf_All_Date_Properties' severity: error then: function: sfDateFormatCheck description: "If a string property has a format of `date` or `date-time`, and\ \ `minLength` and `maxLength` are specified, they should correctly reflect the\ \ length of a valid date or date-time string.\n\n#### valid Json\n\n```json\n\ {\n \"type\": \"object\",\n \"properties\": {\n \"endDate\": {\n \"\ type\": \"string\",\n \"format\": \"date\",\n \"minLength\": 10,\n\ \ \"maxLength\": 10,\n \"example\": \"2023-08-18\"\n }\n }\n}\n\ ```\n\n#### Invalid Json\n\n```json\n{\n \"type\": \"object\",\n \"properties\"\ : {\n \"endDate\": {\n \"type\": \"string\",\n \"format\": \"date\"\ ,\n \"minLength\": 5, // Invalid, should match length of a valid date\ \ string\n \"maxLength\": 20, // Invalid, should match length of a valid\ \ date string\n \"example\": \"2023-08-18\"\n }\n }\n}\n```" message: '''minLength'' and ''maxLength'' if specified, for a string property with format as date / date-time, should be correct' resolved: false sf_problem_json_required_field: given: - '#sf_Problem_Json_Model' severity: 'off' then: - function: defined field: properties.type - function: defined field: properties.title - function: defined field: properties.status description: "The ProblemJson model must exist within the OpenAPI specification\ \ and include the following required properties and json payload:\n\n- type\n\ - title\n- status\n\n#### Valid Json Example\n```json\n\"ProblemJson\": {\n\ \ \"title\": \"ProblemJson\",\n \"description\": \"This schema defines a structured\ \ problem details\",\n \"x-stoplight\": {\n \"id\": \"xmrewz8ybd807\"\n\ \ },\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \"\ title\",\n \"status\"\n ],\n \"properties\": {\n \"type\": {\n \ \ \"type\": \"string\",\n \"format\": \"uri\",\n \"description\": \"A\ \ URI reference that identifies the problem type. This specification encourages\ \ that, when dereferenced, it provides human-readable documentation for the\ \ problem type.\",\n \"example\": \"https://example.com/probs/out-of-credit\"\ ,\n \"minLength\": 10,\n \"maxLength\": 2048,\n \"pattern\": \"^(https?|ftp):\\\ \\/\\\\/[^\\\\s/$.?#].[^\\\\s]*$\"\n },\n \"title\": {\n \"type\"\ : \"string\",\n \"description\": \"A short, human-readable summary of the\ \ problem type. It SHOULD NOT change from occurrence to occurrence of the problem,\ \ except for purposes of localization.\",\n \"example\": \"Insufficient\ \ credit\",\n \"minLength\": 1,\n \"maxLength\": 256,\n \"pattern\"\ : \"^[\\\\w\\\\s-]+$\"\n },\n \"status\": {\n \"type\": \"integer\"\ ,\n \"format\": \"int32\",\n \"description\": \"The HTTP status code\ \ generated by the origin server for this occurrence of the problem.\",\n \ \ \"example\": 400,\n \"minimum\": 400,\n \"maximum\": 599,\n \ \ \"exclusiveMinimum\": false,\n \"exclusiveMaximum\": false\n },\n\ \ \"detail\": {\n \"type\": \"string\",\n \"description\": \"A\ \ human-readable explanation specific to this occurrence of the problem.\",\n\ \ \"example\": \"Your account balance is too low to complete this transaction.\"\ ,\n \"minLength\": 1,\n \"maxLength\": 1024,\n \"pattern\": \"\ ^[\\\\w\\\\s,.-]+$\"\n },\n \"instance\": {\n \"type\": \"string\"\ ,\n \"format\": \"uri\",\n \"description\": \"A URI reference that\ \ identifies the specific occurrence of the problem. It may or may not yield\ \ further information if dereferenced.\",\n \"example\": \"https://example.com/account/12345/transactions/abc\"\ ,\n \"minLength\": 10,\n \"maxLength\": 2048,\n \"pattern\":\ \ \"^(https?|ftp):\\\\/\\\\/[^\\\\s/$.?#].[^\\\\s]*$\"\n \n }\n }\n\ }\n```" message: 'The ''ProblemJson'' model must exist and include the required properties: ''type'', ''title'', ''status''.' json_check: given: - '#sf_Response_4XX-5XX_Ref' severity: error then: function: schema functionOptions: schema: type: object properties: name: type: string dialect: auto message: check json response resolved: false sf_enum_no_whitespace: given: - '#All_Enum_Value' severity: error then: function: pattern functionOptions: match: ^\S*$ message: Enum values should not contain whitespace. sf_ref-properties-must-have-description: given: - '#sf_All_Ref_Properties' severity: error then: function: truthy field: description description: Properties with $ref must also have a description field to provide context about the referenced schema's usage in this specific context. message: 'Property with #ref must have a description field' formats: - oas3 contact-url: given: - '#API_Contact' severity: warn then: function: truthy field: url description: "The `contact` object should have a valid organization URL. \r\n\r\ \n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"contact\": {\r\n\ \ ... ,\r\n \"url\": \"https://acme.com\",\r\n ... \r\n},\r\n```" message: Contact object should have "url". contact-email: given: - '#API_Contact' severity: warn then: function: truthy field: email description: "The `contact` object should have a valid email. \r\n\r\n**Valid\ \ Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"contact\": {\r\n ...\ \ ,\r\n ... ,\r\n \"email\": \"support.contact@acme.com\"\r\n},\r\n\ ```" message: Contact object should have "email" info-contact: given: - '#API_Document' severity: warn then: function: truthy field: info.contact description: "The `info' object should include a `contact` object.\r\n\r\n**Valid\ \ Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"info\": {\r\n ... ,\r\n\ \ ... ,\r\n \"contact\": {\r\n \"name\": \"ACME Corporation\",\r\n\ \ \"url\": \"https://acme.com\",\r\n \"email\": \"support.contact@acme.com\"\ \r\n }\r\n } \r\n}\r\n```" message: Info object should have "contact" object. info-description: given: - '#API_Document' severity: error then: function: truthy field: info.description description: "The `info` object should have a `description` object.\r\n\r\n**Valid\ \ Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"info\": {\r\n ... ,\r\n\ \ ... ,\r\n \"description\": \"This describes my API.\",\r\n ... \r\ \n }\r\n } \r\n}\r\n```" message: Info object should have "description" object. info-license: given: - '#API_Document' severity: warn then: function: truthy field: info.license description: "The `info` object should have a `license` object. \r\n\r\n**Valid\ \ Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"info\": {\r\n ... ,\r\n\ \ ... ,\r\n \"license\": {\r\n \"name\": \"Attribution-ShareAlike\ \ 4.0 International (CC BY-SA 4.0)\",\r\n \"url\": \"https://creativecommons.org/licenses/by-sa/4.0/\"\ \r\n }\r\n } \r\n}\r\n```" message: Info object should have "license" object. license-url: given: - '#API_License' severity: warn then: function: truthy field: url description: "The `license` object should include a valid url.\r\n\r\n**Valid\ \ Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"license\": {\r\n \"name\"\ : \"Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)\",\r\n \"url\"\ : \"https://creativecommons.org/licenses/by-sa/4.0/\"\r\n }\r\n}\r\n```" message: License object should include "url". no-eval-in-markdown: given: - '#All_Markdown' severity: warn then: function: pattern functionOptions: notMatch: eval\( description: "Markdown descriptions should not contain [`eval()` functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval),\ \ which pose a security risk. \r\n\r\n**Invalid Example**\r\n\r\n```json lineNumbers\r\ \n{ \r\n \"info\": {\r\n ... ,\r\n ... , \r\n \"description\": \"\ API for users. eval()\"" message: Markdown descriptions must not have "eval(". no-script-tags-in-markdown: given: - '#All_Markdown' severity: warn then: function: pattern functionOptions: notMatch: ',\"\r\n```" message: Markdown descriptions must not have "