generator icon indicating copy to clipboard operation
generator copied to clipboard

Generator cannot handle referenced types (in separate files)

Open oskarcarlstedt opened this issue 1 year ago • 10 comments

Describe the bug

It looks like the generator cannot handle types that are referenced in other files. Declaring the type locally in the schemas section works perfectly, but not when declaring the type in a separate file and referencing it.

I like to use the same model definitions in OpenAPI and AsyncAPI implementations. Therefore I want to share some types between these two types of API definitions.

How to Reproduce

Just run the generator using the java-spring template and we gen an error saying this is not an AsynAPI file.

asyncapi: "2.6.0" info: title: An asynchronous API version: 1.0.0 description: | An API dealing with asynchronous actions on some objects

defaultContentType: application/json channels: objects.new: subscribe: operationId: pushNewObjectToSubscribers message: $ref: "#/components/messages/ObjectMessage"

components: messages: ObjectMessage: payload: $ref: "types.yaml#/components/schemas/SomeType". <<<--- This is the type that cannot be found

Expected behavior

Find and read the type in the reference file.

oskarcarlstedt avatar Jun 30 '23 08:06 oskarcarlstedt