Using dry-validation with a pre-existing OpenAPI YAML

Right.

I understand that I would have to (1) create a compiler for the OAS YAML format, (2) generate an AST from it and (3) input into dry-schema. The “input into dry-schema” is the uncertain part. For instance, schema.to_ast exists, but is there something like schema.from_ast?

I supposed not, so the remaining option for inputting the OAS AST into dry-schema is, I suppose, for the compiler to call those dry-schema methods such as required and optional and so forth directly.

I’m still studying the complexity of all this vs just going with some OAS gem. dry-validation’s errors would be ideal though.

Thanks a lot for the reply.

p.s. the reason why I’m not writing rules dry-schema first then exporting to OAS is because OAS is a much richer format, with examples, descriptions, URL scope and so forth, so exporting would be lossy. Multiple teams over here are using that OAS file independently.