Generate validation from OpenAPI Spec - as described in README
bastianwegge opened this issue · comments
Hello 👋 ,
I just found this awesome repo and I'm wondering about the generation of validation from OpenAPI Spec. In the README there's a paragraph stating:
SignUpInput:
type: object
properties:
...
firstName:
type: string
pattern: ^[0-9a-zA-Z]*$
maxLength: 255
...
required:
...
- firstName
...
OpenAPI Codegen will be able to generate all the relevant validation (or at least give you the choice to do it).
As I was playing around with the generation of this specific example, I generated the following result:
/**
* @pattern ^[0-9a-zA-Z]*$
* @maxLength 255
*/
firstName: string;
It picks up the required
state into the type itself and the documentation inside of the type is copied from the OpenAPI spec as you can see below. Am I missing something very obvious or did I just misread the part where the README says "... generate all the relevant validation ..."?
Hello 👋
Yeah, the idea was to combine this library with https://github.com/fabien0102/ts-to-zod , but I didn’t really take the time so far