Linting Rules - OpenAPI V3 - Schema Properties Allowed Integer Format
Number of APIs: 1
This is a Spectral governance rule to enforce that OpenAPI properties that use integer type have a format of int32 or int64. Here is a JSON version of the rule that can be applied using this API-driven collection API, or at CLI or CI/CD pipeline.
{
"openapi-v3-schema-properties-allowed-integer-format": {
"description": "Requires integer properties to have a format of int32 or int64.",
"message": "Type format should be be int32 or int64.",
"formats": [
"oas3"
],
"severity": "hint",
"recommended": true,
"given": "$..properties.[?(@.type==\"integer\")]",
"then": {
"field": "format",
"function": "enumeration",
"functionOptions": {
"values": [
"int32",
"int64"
]
}
}
}
}
This request can be run as part of this collection, or dragged and dropped to another collection of governance requests organized by folder, demonstrating how API governance linting works, but also providing a rule that can be used as part of your wider API governance strategy.