TBD54566975 / tbdex

56 stars 25 forks source link

revert external refs to types #291

Closed kirahsapong closed 7 months ago

kirahsapong commented 7 months ago

external $refs introduces ajv generating a require in our ts validator. these $refs are valid to use but due to ajv injecting require syntax with externally resolved urls, reverting to type: object

decentralgabe commented 7 months ago

why is require syntax a problem? if we are requiring json schemas it would be better to enforce it

kirahsapong commented 7 months ago

@decentralgabe require isn't available in ES execution environments

decentralgabe commented 7 months ago

is there a workaround that can maintain the $ref?

the value of json schema validation is to enforce the shape we require...without being able to enforce that shape (and just a generic object) is the schema giving us much utility?

phrased differently - if we can't enforce the properties are valid json schemas here, where else can we do it?

kirahsapong commented 7 months ago

yeah fair points. will close this and move to common in our sdk if no objections