Skip to content

Crash on duplicate schema name with idiomatic naming strategy #854

@marknefedov

Description

@marknefedov

Description

PS C:\Users\mark_\Desktop\kratos-client-swift> swift build
Building for debugging...
Swift OpenAPI Generator is running with the following configuration:
- OpenAPI document path: C:/Users/mark_/Desktop/kratos-client-swift/Sources/kratos-client-swift/openapi.json
- Configuration path: C:/Users/mark_/Desktop/kratos-client-swift/Sources/kratos-client-swift/openapi-generator-config.yaml
- Generator modes: types, client
- Access modifier: internal
- Naming strategy: idiomatic
- Name overrides: <none>
- Type overrides: <none>
- Feature flags: <none>
- Output file names: Types.swift, Client.swift
- Output directory: C:/Users/mark_/Desktop/kratos-client-swift/.build/plugins/outputs/kratos-client-swift/kratos-client-swift/destination/OpenAPIGenerator/GeneratedSources
- Diagnostics output path: <none - logs to stderr>
- Current directory: C:\Users\mark_\Desktop\kratos-client-swift
- Plugin source: build
- Is dry run: false
- Additional imports: <none>
- Additional file comments: <none>Swift/NativeDictionary.swift:792: Fatal error: Duplicate values for key: 'NullTime'
Current stack trace:
0    swiftCore.dll                      0x00007ffe6395bb40 swift_reportError + 94
1    swiftCore.dll                      0x00007ffe639fb620 swift_stdlib_reportFatalErrorInFile + 132
2    swiftCore.dll                      0x00007ffe63657ff0 StaticString.withUTF8Buffer<A>(_:) + 1060
3    swiftCore.dll                      0x00007ffe63657090 _assertionFailure(_:_:file:line:flags:) + 326
4    swiftCore.dll                      0x00007ffe639373e0 swift_dynamicCastForeignClassMetatypeUnconditional + 29378
5    swiftCore.dll                      0x00007ffe636a48f0 Dictionary.init<A>(uniqueKeysWithValues:) + 351
6    swift-openapi-generator-tool.exe   0x00007ff68648fbed <unavailable> + 13302765
7    swift-openapi-generator-tool.exe   0x00007ff6864f7a7f <unavailable> + 13728383
8    swift-openapi-generator-tool.exe   0x00007ff6864bbea4 <unavailable> + 13483684
9    swift-openapi-generator-tool.exe   0x00007ff686462a8a <unavailable> + 13118090
10   swift-openapi-generator-tool.exe   0x00007ff686465a43 <unavailable> + 13130307
11   swift-openapi-generator-tool.exe   0x00007ff686339e1a <unavailable> + 11902490
12   swift-openapi-generator-tool.exe   0x00007ff68633aba5 <unavailable> + 11905957
13   swift-openapi-generator-tool.exe   0x00007ff6862e352e <unavailable> + 11547950
14   swift-openapi-generator-tool.exe   0x00007ff6862e36b7 <unavailable> + 11548343
15   swift-openapi-generator-tool.exe   0x00007ff6862e49dd <unavailable> + 11553245
16   swift-openapi-generator-tool.exe   0x00007ff6862e17bd <unavailable> + 11540413
17   swift-openapi-generator-tool.exe   0x00007ff6862e1d88 <unavailable> + 11541896
18   swift-openapi-generator-tool.exe   0x00007ff686544ecd <unavailable> + 14044877
19   swift-openapi-generator-tool.exe   0x00007ff686545056 <unavailable> + 14045270
20   swift-openapi-generator-tool.exe   0x00007ff68654438b <unavailable> + 14041995
21   swift-openapi-generator-tool.exe   0x00007ff686543b33 <unavailable> + 14039859
22   swift-openapi-generator-tool.exe   0x00007ff68654380c <unavailable> + 14039052
23   swift_Concurrency.dll              0x00007ffe86781c00 AsyncMapSequence.transform.getter + 24654
24   swift_Concurrency.dll              0x00007ffe867887f0 swift_job_run + 114
25   dispatch.dll                       0x00007ffe8309a920 dispatch_assert_queue_barrier + 1008
26   dispatch.dll                       0x00007ffe8309a920 dispatch_assert_queue_barrier + 632
27   dispatch.dll                       0x00007ffe830a2d70 dispatch_prohibit_transition_to_multithreaded + 8323
28   ucrtbase.dll                       0x00007fff0ad13660 wcsrchr + 336
29   KERNEL32.DLL                       0x00007fff0cbfe8c0 BaseThreadInitThunk + 23
30   ntdll.dll                          0x00007fff0d14c510 RtlUserThreadStart + 44
[5/7] Running swift-openapi-generator

Reproduction

Checkout repro repo: https://github.com/marknefedov/swift-openapi-repro

Run swift build on windows machine.

Package version(s)

swift package show-dependencies
.
├── swift-openapi-generator<https://github.com/apple/[email protected]>
│   ├── swift-algorithms<https://github.com/apple/[email protected]>
│   │   └── swift-numerics<https://github.com/apple/[email protected]>
│   ├── swift-collections<https://github.com/apple/[email protected]>
│   ├── openapikit<https://github.com/mattpolzin/[email protected]>
│   │   └── yams<https://github.com/jpsim/[email protected]>
│   ├── yams<https://github.com/jpsim/[email protected]>
│   └── swift-argument-parser<https://github.com/apple/[email protected]>
├── swift-openapi-runtime<https://github.com/apple/[email protected]>
│   └── swift-http-types<https://github.com/apple/[email protected]>
└── swift-openapi-urlsession<https://github.com/apple/[email protected]>
    ├── swift-openapi-runtime<https://github.com/apple/[email protected]>
    │   └── swift-http-types<https://github.com/apple/[email protected]>
    ├── swift-http-types<https://github.com/apple/[email protected]>
    └── swift-collections<https://github.com/apple/[email protected]>

Expected behavior

Error is gracefully handled or client is generated.

Environment

swift -version
Swift version 6.2.3 (swift-6.2.3-RELEASE)
Target: x86_64-unknown-windows-msvc
Build config: +assertions

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/generatorAffects: plugin, CLI, config file.kind/bugFeature doesn't work as expected.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions