Formatting & Casing
Enforce consistent casing across operationIds, properties, parameters, and component keys.
Try formatting in the PlaygroundCLI Usage
Terminal
npx openapi-format openapi.json -o output.json --casingFile customCasing.yamlCasing Types
| Type | Alias | Example |
|---|---|---|
| camelCase | camelCase | openapiFormat |
| PascalCase | PascalCase | OpenapiFormat |
| kebab-case | kebabCase | openapi-format |
| Train-Case | TrainCase | Openapi-Format |
| snake_case | snakeCase | openapi_format |
| Ada_Case | AdaCase | Openapi_Format |
| CONSTANT_CASE | constantCase | OPENAPI_FORMAT |
| COBOL-CASE | cobolCase | OPENAPI-FORMAT |
| Dot.notation | dotNotation | openapi.format |
| Space case | spaceCase | openapi format |
| Capital Case | capitalCase | Openapi Format |
| lower case | lowerCase | openapi format |
| UPPER CASE | upperCase | OPENAPI FORMAT |
Configurable Elements
| Key | Description |
|---|---|
| operationId | Operation IDs in the Operations Object |
| properties | Schema property keys (inline & components) |
| parametersQuery | Query parameter names |
| parametersHeader | Header parameter names |
| parametersPath | Path parameter names |
| parametersCookie | Cookie parameter names |
| componentsSchemas | Schema model keys & $ref links |
| componentsExamples | Example model keys & $ref links |
| componentsHeaders | Header model keys & $ref links |
| componentsResponses | Response model keys & $ref links |
| componentsRequestBodies | Request body model keys & $ref links |
| componentsSecuritySchemes | Security scheme keys & $ref links |
| componentsParametersQuery | Query parameter component keys |
| componentsParametersHeader | Header parameter component keys |
| componentsParametersPath | Path parameter component keys |
| componentsParametersCookie | Cookie parameter component keys |
Full Configuration Example
customCasing.yaml
operationId: snake_case
properties: camelCase
parametersQuery: kebab-case
parametersHeader: kebab-case
parametersPath: snake_case
componentsExamples: PascalCase
componentsSchemas: camelCase
componentsHeaders: kebab-case
componentsResponses: snake_case
componentsRequestBodies: snake_case
componentsSecuritySchemes: PascalCase
componentsParametersQuery: snake_case
componentsParametersHeader: kebab-case
componentsParametersPath: camelCaseExample: operationId
casing.yaml
operationId: kebab-caseBefore
paths:
/pets:
get:
operationId: getPets
/pets/{petId}:
get:
operationId: getPetById
delete:
operationId: deletePetAfter
paths:
/pets:
get:
operationId: get-pets
/pets/{petId}:
get:
operationId: get-pet-by-id
delete:
operationId: delete-petExample: Schema Properties
casing.yaml
properties: snake_caseBefore
components:
schemas:
UserModel:
type: object
properties:
id:
type: integer
example: 10
emailAddress:
type: string
example: [email protected]
firstName:
type: string
example: John
lastName:
type: string
example: DoeAfter
components:
schemas:
UserModel:
type: object
properties:
id:
type: integer
example: 10
email_address:
type: string
example: [email protected]
first_name:
type: string
example: John
last_name:
type: string
example: DoeExample: Component Keys
casing.yaml
componentsSchemas: PascalCaseBefore
paths:
/orders:
get:
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/order-model'
components:
schemas:
userModel:
type: object
order-model:
type: object
pet_model:
type: objectAfter — keys + $ref links updated
paths:
/orders:
get:
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/OrderModel'
components:
schemas:
UserModel:
type: object
OrderModel:
type: object
PetModel:
type: objectExample: Parameter Names
casing.yaml
parametersPath: kebab-case
parametersQuery: snake_caseBefore
paths:
'/pet/{petId}':
get:
parameters:
- name: petId
in: path
description: ID of pet to return
- name: includeDetails
in: query
description: Include full details
- $ref: '#/components/parameters/LimitParam'
components:
parameters:
LimitParam:
name: limitParam
in: queryAfter
paths:
'/pet/{petId}':
get:
parameters:
- name: pet-id
in: path
description: ID of pet to return
- name: include_details
in: query
description: Include full details
- $ref: '#/components/parameters/LimitParam'
components:
parameters:
LimitParam:
name: limit_param
in: query