Fourth pattern of our series: naming conventions for unnamed things. When Kiota generates models for requests bodies and responses, two cases are possible: either the type is defined in a reusable component schema, which means the component is named and Kiota can use that name for the generated model. Or the type is defined inline, in which case Kiota needs to rely on naming conventions.
paths:
/path:
get:
summary: Get
description: Get
operationId: get
tags:
- api1
responses:
'200':
description: OK
content:
application/json:
schema:
type: object # PathResponse
properties:
inlineProperty:
type: object # PathResponseInlinePropertyModel
properties:
subInlineProp:
type: object # PathResponseInlinePropertyModelSubInlinePropModel
properties:
subSubInlineProp:
type: string
inlineArrayProperty:
type: array
items:
type: object # PathResponseInlineArrayPropertyModel
properties:
subInlineProp:
type: string
In the snippet above the generated types will be named according to the path segment name and according to naming suffixes always appended to the parent type name. While it works, the generator should not have the responsibility to arbitrarily define naming conventions. There should instead be a placeholder for the API owner to dictate those conventions.