OpenAPI generator usage question - multiple spec files

I was exploring a side project to read and process a generated DocC archive, with the idea of leveraging the OpenAPI schema specs that the DocC project provides at swift-docc/Sources/SwiftDocC/SwiftDocC.docc/Resources at main · swiftlang/swift-docc · GitHub.

They have standalone files that appear to be independent, and I was able to generate a Types declaration using the openAPI generator. The generator, however, always generated Types.swift, and there didn't seem to be an option to leverage more than one of these OpenAPI schema declarations.

If I want to generate the multiple of these types together (for example RendexIndex and RenderNode) into the same Types.swift, would the best way be to manually combine the separate OpenAPI schema files, or is there an option to generate individual files from the swift-openapi-generator?

(Right now I'm doing this manually with swift run swift-openapi-generator to more easily explore the generated files)

Is there a right way or easy path that I'm missing that I should explore here?

-- joe

1 Like

Hi @Joseph_Heck,

Swift OpenAPI Generator allows you to only generate code from a single OpenAPI doc into a single Swift module. The idea is that you can always import the generated types from these potentially multiple modules into a single "integration" module, where you use them all together.

This is intentional, we didn't want to reimplement much of what Swift modules already provide out of the box, like namespacing of types, and so on.

Using a tool that merges multiple OpenAPI docs into one is another option here.

1 Like

CC @Paul_Hudson