Skip to content

Issues with anchors and UNKNOWN_BASE_TYPE #1

@kasandell

Description

@kasandell

Hi All,

I'm currently trying to use the spec provided to generate a client in Rust (but experiencing these issues regardless of output language). As is, with the spec, when I run either openapi-generator or openapi-generator-cli, both on versions 7.1.0, any section that uses YAML anchors causes the following issues:

openapi-generator-cli generate -g rust \
-i https://raw.githubusercontent.com/lithic-com/lithic-openapi/main/lithic-openapi.yml \
-o lithic_client
Exception in thread "main" org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
 | Error count: 9, Warning count: 17
Errors:
	-attribute .components.schemas.EventSubscription.enum is not of type `array` (#/components/schemas/EventSubscription)
	-attribute .components.schemas.Event.enum is not of type `array` (#/components/schemas/Event)
	-attribute .components.schemas.BankAccountApiResponse.enum is not of type `array` (#/components/schemas/BankAccountApiResponse)
	-attribute .components.schemas.MessageAttempt.enum is not of type `array` (#/components/schemas/MessageAttempt)
	-attribute .components.schemas.FinancialAccount.enum is not of type `array` (#/components/schemas/FinancialAccount)
	-attribute .components.schemas.Balance.enum is not of type `array` (#/components/schemas/Balance)
	-attribute .components.schemas.AggregateBalance.enum is not of type `array` (#/components/schemas/AggregateBalance)
	-attribute .components.schemas.Dispute.enum is not of type `array` (#/components/schemas/Dispute)
	-attribute .components.schemas.Transaction.enum is not of type `array` (#/components/schemas/Transaction)
Warnings:
	-attribute .components.schemas.EventSubscription.enum is not of type `array` (#/components/schemas/EventSubscription)
	-attribute .components.schemas.Event.enum is not of type `array` (#/components/schemas/Event)
	-attribute .components.schemas.BankAccountApiResponse.enum is not of type `array` (#/components/schemas/BankAccountApiResponse)
	-attribute .components.schemas.MessageAttempt.enum is not of type `array` (#/components/schemas/MessageAttempt)
	-attribute .components.schemas.FinancialAccount.enum is not of type `array` (#/components/schemas/FinancialAccount)
	-attribute .components.schemas.Balance.enum is not of type `array` (#/components/schemas/Balance)
	-attribute .components.schemas.AggregateBalance.enum is not of type `array` (#/components/schemas/AggregateBalance)
	-attribute .components.schemas.Dispute.enum is not of type `array` (#/components/schemas/Dispute)
	-attribute .components.schemas.Transaction.enum is not of type `array` (#/components/schemas/Transaction)

	at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:684)
	at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:711)
	at org.openapitools.codegen.cmd.Generate.execute(Generate.java:511)
	at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
	at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)

I've gotten around this by using YQ to expand these sections verbosely, but am now faced with the following.

WARN  o.o.codegen.DefaultCodegen - codegenModel is null. Default to UNKNOWN_BASE_TYPE

which generates the UNKNOWN_BASE_TYPE symbol in the client and causes compilation issues.

I was wondering what version of the openapi generator is being used to create a client from this file? Additionally, if there is any information on the underlying jackson version being used to parse the YAML, since that seems to be the root cause of not being able to parse anchors properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions