Trouble Generating JSONSchema from Postgres JSONB Columns with Effect Typescript Library
I'm having some trouble generating JSONSchema from fields of another schema. What I'm doing is querying postgres to find all my jsonb columns, loading the schemas that represent the tables, and trying to generate a JSONSchema for each field representing a column that is jsonb. I want to validate my jsonb fields with pg_jsonschema.
I'm struggling to get the correct schema for a field to pass to JSONSchema.make.
If I access it as
Any ideas about the right way to do this?
I'm struggling to get the correct schema for a field to pass to JSONSchema.make.
If I access it as
mainSchema.fields[fieldForJsonSchema] that gives me the property signature which is a transformation if the field is optional. I can get the AST for the correct type from the property signature but then I have an AST not a schema and I don't see any way to turn that AST back into a schema to pass to JSONSchema.make. Any ideas about the right way to do this?
