Converting schema to standard JSON Schema


#1

Hi All,

I’ve been familiarising myself with DF - and from what I understand so far, it seems that the schema files generated from the database are not standard JSON schema files (I appreciate the rationale for this). I was wondering if there is any way to generate standard JSON schema (https://json-schema.org) directly from the database. I am happy to convert this myself, but just wanted to check before re-inventing any wheels (the rationale for this is that I would like to dynamically generate some client side code which can be done directly with a JSON schema files).

Cheers

Alex.


#2

Hi @rockgoby,

Could you please clarify, are you referring to the resource tag?

Best,
Kevin


#3

HI Kevin,

Yes - exactly. I see this contains a lot more information than JSON Schema, but it would be good to be able to produce standard JSON Schema files for the database also,

Kind regards

Alex.


#4

@rockgoby2,

To remove the resource wrapper you can edit your .env file to not be enable. It can be found under the API Settings section (https://cl.ly/69f2035f1621). When making changes of this sort please make sure to run php artisan cache:clear and php artisan config:clear to ensure the changes are picked up.


#5

Thanks again Kevin - ah, OK - no, I don’t want to just remove the resource wrapper. I would actually like to be able to configure the output to conform to the JSON Schema conventions - is there a template somewhere that governs this?

I would like to modify the output /_schema/{table_name} to be more in alignment with : this format

I appreciate that I could just do some external conversion, but it would be helpful if I could configure DF to do this.

Kind regards

Alex.