Describe the bug
read-only-write-only-model-type doesn't support refs to others schemas with readOnly properties. In the example below, I assume the generator creates ChildResponse and ChildRequest, then search for Child when generating Parent. Same behavior if Parent also has a readOnly property.
To Reproduce
Example schema:
openapi: "3.0.0"
info:
title: broken readonly $ref
version: "1.0"
paths: {}
components:
schemas:
Child:
properties:
opt:
readOnly: true
type: integer
Parent:
properties:
child:
$ref: "#/components/schemas/Child"
opt:
readOnly: true
type: integer
Used commandline:
$ datamodel-codegen --input example.yaml --read-only-write-only-model-type request-response
Expected behavior
If $ref points to a schema with readonly fields, the parent schema should always be a request/response, and use the right ref.
Version:
- OS: linux
- Python version: 3.14
- datamodel-code-generator version: 0.55.2
Describe the bug
read-only-write-only-model-type doesn't support refs to others schemas with readOnly properties. In the example below, I assume the generator creates
ChildResponseandChildRequest, then search forChildwhen generatingParent. Same behavior ifParentalso has a readOnly property.To Reproduce
Example schema:
Used commandline:
Expected behavior
If
$refpoints to a schema with readonly fields, the parent schema should always be a request/response, and use the right ref.Version: