datacontract / datacontract-specification

The Data Contract Specification Repository
https://datacontract.com/
MIT License
276 stars 41 forks source link

Extract out different types of servers to defs, ensure server required fields are populated #89

Closed pflooky closed 2 months ago

pflooky commented 3 months ago

Context

I'm looking to add support for datacontract-specification to Data Caterer. I'm using the JSON schema to define how to ingest the metadata from the data contract. Using the examples, I found some validation errors in the servers section. Also, using the tool ajv to help validate the JSON schema, it stated that x-extensible-enum is not valid for JSON schema draft-07.

Problem

It seems like due to type: dataframe not having any properties defined, it becomes the default server from the oneOf list in the JSON schema. before_schema_validation

This also has the side effect of the IDE or consumer of the JSON schema to suggest properties from any of the server types. before_suggestions

Another small issue that I'm not sure if it is an issue or not, but the description and environment properties under servers are applied at the top-level object. Is this meant to be at the top level or per server? In this PR, I have included it at the per-server level. Screenshot 2024-08-02 at 7 39 43 PM

Proposed Solution

What postgres property suggestions look like after using above changes: after_suggestions

jochenchrist commented 2 months ago

Thanks for your contribution. Had to merge manually. Will be part of next release.