openapi-ts / openapi-typescript

Generate TypeScript types from OpenAPI 3 specs
https://openapi-ts.dev
MIT License
5.74k stars 460 forks source link

`--properties-required-by-default` and `--default-non-nullable` flags do not work #1651

Open cekpowell opened 5 months ago

cekpowell commented 5 months ago

Description

The --properties-required-by-default and --default-non-nullable flags do not work. If you include these flag in the CLI, the execution hangs forever. From this issue it also seems like the same thing is happening with --path-params-as-types. If you remove these flags, the execution works fine.

Name Version
openapi-typescript 6.7.5
Node.js 18.18.2
OS + version macOS 14.0

Reproduction

Run any generation command with --properties-required-by-default, --default-non-nullable or --path-params-as-types flags, and you will see the execution hangs.

Checklist

magnattic commented 5 months ago

I tried 7.0.0-next.11 in the hopes of this being fixed in the new version, but same problem. Is there an older version where this works?

f-ricci commented 4 months ago

This is still not working for 7.0.0-rc.0

drwpow commented 3 months ago

Is anyone able to provide a reproduction of this issue? We have tests for both that test they’re working that are both passing.

rumyanar commented 3 months ago

In 7.0.1 I'm experiencing a related issue - the option -properties-required-by-default has no effect. It doesn't hang the CLI as in the original comment. I'm also experiencing https://github.com/openapi-ts/openapi-typescript/issues/1467 even the required fields are optional

 "DeviceDto": {
        "type": "object",
        "properties": {
          "deviceId": {
            "type": "string",
            "format": "uuid",
            "required": true
          },
          "name": {
            "type": "string",
          },

outputs:

DeviceDto: {
            /** Format: uuid */
            deviceId?: string;
            name?: string;
}
github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open for 90 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

magnattic commented 2 weeks ago

Just tried it with 7.4.1 and both flags work for me. I think this can be closed.