-
-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I generate a schema with format: int32
?
#1447
Comments
Is the format int32 supported only in the OpenAPI 3.1? How about in the Swagger v2 or OpenAPI v3.0? I will update both |
@samchon Here are the relevant references: I hope this helps clarify things. |
Looking at the Swagger v2 specification, both However, looking at the OpenAPI v3 and OpenAPI v3.1 specs, the
Instead, I'd traveled another JSON schema based validator libraries like When I've tested in the Swagger-UI, the numeric format restriction has not affected anything. The Swagger-UI just handled the numeric format restriction as unknown property. Therefore, I should be careful about this suggestion. As it is not a regular specification of JSON schema, and even not well documented in the OpenAPI specification, we need more researches. Additionally, I'm wonder whethering that
|
@KoharaKazuya If you still need the numeric format restriction right now, please use the import typia, { tags } from "typia";
interface IMember {
id: number & tags.JsonSchemaPlugin<{
format: "float"
}>;
}
typia.llm.parameters<IMember, "claude">(); |
I will publish |
Wow, this is amazing. Thank you for sharing the workaround! It looks like this will resolve my issue for now. I'm glad to see this resolved since I wanted to use it in combination with a documentation tool like ReDoc. FYI: In the OpenAPI Specification, starting from v3.0.4, there's a note that In other words, in the OpenAPI Specification, a That said, |
If You should keep using the When you find another way, please tell me. |
I am trying to define an OpenAPI Document schema using Typia. Specifically, I am attempting to replicate the
GeneralError
example from the OpenAPI Specification v3.1.1.https://github.com/OAI/OpenAPI-Specification/blob/ba75c2949fc475367d80a1178fd9a71a299e2375/versions/3.1.1.md#L609-L620
When I tested this on the Typia Playground, the output did not include
format: "int32"
.https://typia.io/playground/?script=JYWwDg9gTgLgBDAnmYBDANHA3g1BzAZzgF84AzKCEOAIiRVRoG4AoF4AOxgFMozUAxtzgBxbh16oANgFEolKNhZw4AiABNuAfgBccDgFcQAI15wAZLkIA6ACrJuAHhqcYAZgBMNAHysVIbgICfG09AhgoTjxWYjY1DnC4AgEAC24QVCIAXgRkNGsAKwIIDmtktIyCRwBtMQkoaTkFAF1vAAoASlYgA
How should I write the schema to output
format: "int32"
?The text was updated successfully, but these errors were encountered: