ex_json_schema icon indicating copy to clipboard operation
ex_json_schema copied to clipboard

Make schema domain configurable

Open ghost opened this issue 3 years ago • 1 comments

We are hosting the schema itself so it would be nice if the schema domain can be configurable. Now we get the following error:

Unsupported schema version, only draft 4, 6, and 7 are supported.

If we host it on for example: http://json-schema.test.docker/draft-07/schema

Suggested code at lib/ex_json_schema/schema.ex#L37

  @current_draft_schema_url Application.get_env(:ex_json_schema, :schema_host, "http://json-schema.org/schema")
  @draft4_schema_url @current_draft_schema_url <> "/draft-04/schema"
  @draft6_schema_url @current_draft_schema_url <> "/draft-06/schema"
  @draft7_schema_url @current_draft_schema_url <> "/draft-07/schema"

Thanks in advance

ghost avatar May 27 '22 09:05 ghost

Hey, so I don't really get the use case for this. The draft schemas are bundled in the lib and will not be fetched over the network. Why would you want to provide your own, identical schemas that have to be fetched remotely? I think there's also a bunch of other functions that match on the schema that won't work out of the box.

jonasschmidt avatar Jun 08 '22 06:06 jonasschmidt