-
-
Notifications
You must be signed in to change notification settings - Fork 272
Closed
Labels
bug 🔥Something isn't workingSomething isn't workingprioritized 🚚This issue has been prioritized and will be worked on soonThis issue has been prioritized and will be worked on soon
Description
Description
Bug Report
Description
The readWrite parser transform fails to generate Readable/Writable types when readOnly/writeOnly properties are defined in referenced schemas ($ref). The transform only works when these properties are defined directly on the main schema.
Expected Behavior
The readWrite transform should generate Readable and Writable type variants regardless of whether readOnly/writeOnly properties are:
- Defined directly on the schema properties
- Defined in referenced schemas (
$ref)
Actual Behavior
- ✅ Works: when defined directly in schema
- ❌ Doesn't Work: when defined in nested schemas
Reproduction
I've attached an example yaml file with configuration
Reproducible example or configuration
https://stackblitz.com/edit/hey-api-client-fetch-example-4rzbayxg
OpenAPI specification (optional)
openapi: 3.1.0
info:
title: ReadWrite Transform Test API
version: 1.0.0
description: Test API demonstrating readWrite transform behavior with different schema patterns
servers:
- url: http://localhost:8080/api/v1
description: Local development server
paths:
/simple-entity:
get:
summary: Get simple entity with direct readOnly properties
description: This should generate SimpleEntityReadable and SimpleEntityWritable types
operationId: getSimpleEntity
responses:
'200':
description: Simple entity retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SimpleEntity'
put:
summary: Update simple entity
description: Update a simple entity
operationId: updateSimpleEntity
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SimpleEntity'
responses:
'200':
description: Simple entity updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SimpleEntity'
/complex-entity:
get:
summary: Get complex entity with nested references
description: This will NOT generate ComplexEntityReadable and ComplexEntityWritable types
operationId: getComplexEntity
responses:
'200':
description: Complex entity retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/ComplexEntity'
put:
summary: Update complex entity
description: Update a complex entity
operationId: updateComplexEntity
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ComplexEntity'
responses:
'200':
description: Complex entity updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/ComplexEntity'
components:
schemas:
SimpleEntity:
type: object
description: Simple entity with direct readOnly and writeOnly properties
properties:
id:
type: string
format: uuid
readOnly: true
description: Unique identifier (server-generated)
name:
type: string
minLength: 1
maxLength: 100
description: Entity name
email:
type: string
format: email
description: Email address
password:
type: string
writeOnly: true
minLength: 8
description: Password (write-only)
secret_key:
type: string
writeOnly: true
description: Secret key (write-only)
created_at:
type: string
format: date-time
readOnly: true
description: Creation timestamp (server-generated)
updated_at:
type: string
format: date-time
readOnly: true
description: Last update timestamp (server-generated)
version:
type: integer
readOnly: true
description: Version number (server-managed)
required:
- id
- name
- email
- created_at
- updated_at
- version
ComplexEntity:
type: object
description: Complex entity with referenced schemas containing readOnly properties
properties:
id:
type: string
format: uuid
description: Entity identifier
name:
type: string
description: Entity name
status:
$ref: '#/components/schemas/StatusInfo'
metadata:
$ref: '#/components/schemas/EntityMetadata'
audit_info:
$ref: '#/components/schemas/AuditInfo'
configuration:
$ref: '#/components/schemas/EntityConfiguration'
required:
- id
- name
- status
- metadata
- audit_info
StatusInfo:
type: string
enum:
- ACTIVE
- INACTIVE
- PENDING
readOnly: true
description: Current status (read-only, system-managed)
EntityMetadata:
type: object
properties:
version:
type: integer
readOnly: true
description: Version number
checksum:
type: string
readOnly: true
description: Data checksum
size:
type: integer
readOnly: true
description: Entity size in bytes
required:
- version
- checksum
- size
AuditInfo:
type: object
properties:
created_by:
type: string
readOnly: true
description: Creator username
created_at:
type: string
format: date-time
readOnly: true
description: Creation timestamp
last_modified_by:
type: string
readOnly: true
description: Last modifier username
last_modified_at:
type: string
format: date-time
readOnly: true
description: Last modification timestamp
required:
- created_by
- created_at
- last_modified_by
- last_modified_at
EntityConfiguration:
type: object
properties:
config_version:
type: string
readOnly: true
description: Configuration version
settings:
type: object
additionalProperties: true
description: Configuration settings
is_locked:
type: boolean
readOnly: true
description: Whether configuration is locked
required:
- config_version
- settings
- is_lockedSystem information (optional)
Version hey-api: 0.80.1
JTran-04, JanFuhrmann, vector-kainzbauer, bvincent1, vinaypuppal and 1 more
Metadata
Metadata
Assignees
Labels
bug 🔥Something isn't workingSomething isn't workingprioritized 🚚This issue has been prioritized and will be worked on soonThis issue has been prioritized and will be worked on soon