apple / apple/swift-openapi-generator

Null property type with quotes not generated

Open
#553 16 comments 1 reaction 0 assignees View on GitHub
kind/bug status/triage
Dominant language
Swift
Stars
2k
Forks
182
Avg merge
13h 28m
Merged PRs (30d)
5

Description

### Description

If in YAML I specify null type with quotes generator omits the property. But if I specify null as a type without quotes everything works well

### Reproduction

```
CustomerUpdate:
properties:
given_name:
anyOf:
- type: string
- type: 'null'
title: Given Name
```

But this works fine:

```
CustomerUpdate:
properties:
given_name:
anyOf:
- type: string
- type: null
title: Given Name
```

The same issue with json, generator works only if null type isn't surrounded by quotes

### Package version(s)

swift-open-api-genrator 1.2.1
swift-openapi-runtime 1.3.2
swift-openapi-urlsession 1.0.1
Yams 5.1.0
OpenAPIKit 3.1.3

### Expected behavior

Generator should parse 'null' - with quotes too

### Environment

swift version: 5.9

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Use the YAML and JSON examples in the issue as the starting reproductions, then trace the generator's schema parsing path for quoted and unquoted null types. Done means both quoted forms preserve the generated property in the same way as their unquoted equivalents.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.