google / gnostic

A compiler for APIs described by the OpenAPI Specification with plugins for code generation and other API support tasks.
Apache License 2.0
2.12k stars 251 forks source link

OpenAPI V3 schema default type should support any #326

Open Jefftree opened 2 years ago

Jefftree commented 2 years ago

I noticed in the code generator for Schema.default, the only acceptable types are bool, string, float, and int. https://github.com/google/gnostic/blob/master/generate-gnostic/generate-compiler.go#L233-L257

The OpenAPI 3.0 schema defines that the default value can be anything (https://github.com/OAI/OpenAPI-Specification/blob/main/schemas/v3.0/schema.json#L513-L514) and does not specify this oneOf clause present in gnostic.

We should be able to support Any for the default

cc @timburks

timburks commented 2 years ago

Makes sense, agreed.

dobet commented 8 months ago

have some plan?