In the core repository we use gavinwahl/postgres-json-schema to validate the resulting OpenAPI document for testing purposes (see jsonschema.sql). It's doesn't look mantained anymore so we need to use another one, preferably in SQL, to start validating the output (I'm doing it manually in the Swagger Editor right now). I think the pg_jsonschema extension is a good alternative.
Edit: see extra info on OpenAPI validation.