Skip to content
This repository has been archived by the owner on Aug 2, 2019. It is now read-only.

[WIP] Add Json schema support #195

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

[WIP] Add Json schema support #195

wants to merge 6 commits into from

Conversation

almet
Copy link
Member

@almet almet commented Aug 9, 2014

  • Plug the new renderer with cornice;
  • Test that all the fields are supported;
  • Decide on a mime type to use.
  • Accept JSON schema for definitions.

Here are the types supported by Daybed that we need to convert to JSON Schema:

  • Integer
  • Text
  • Datetime
  • Boolean
  • Regex
  • JSON
  • Anyof
  • Email
  • OneOf
  • String
  • Object
  • Date
  • Url
  • List
  • Choices
  • Range

GeoTypes:

  • Point
  • Polygon
  • GeoJSON
  • Line

@leplatrem
Copy link
Contributor

Great ! We should definitely follow standards ! ref #53
I could help you on this, this is quite a big task :)

@almet
Copy link
Member Author

almet commented Aug 9, 2014

I added some changes to the branch, and I updated the description to contain the list of fields we currently support in daybed.

I'll be out starting tomorrow for one week, don't hesitate to continue what I started :)

@almet
Copy link
Member Author

almet commented Aug 9, 2014

A few outstanding questions:

  • How do we deal with relation between models? (I guess we should set them to integers / strings depending the case);
  • How do we handle the JSON and GeoJSON fields? We could do a (really long) regexp, but I wonder if there is another take on it?
  • Handling objects and lists will be fun :)

@almet
Copy link
Member Author

almet commented Aug 9, 2014

FWIW, here is the doc I'm using as a reference https://spacetelescope.github.io/understanding-json-schema/

@Natim
Copy link
Member

Natim commented Aug 10, 2014

For relations between models modelname is a string.

@leplatrem
Copy link
Contributor

I was wondering if it is still relevant to have our own schema formalism... I mean, instead of formatting our custom stuff to the standard JSON schema, just accept it as input for model creation ?

@Natim
Copy link
Member

Natim commented Aug 11, 2014

For know it is relevant because our schema is close to what daybed do.
Btw we could implement both input formalisms if we need to be compatible somehow and ask the question again then.

@almet
Copy link
Member Author

almet commented Aug 18, 2014

@leplatrem, I was wondering the exact same thing.

I believe what we have for daybed is simpler than json schema, but I may be wrong. Especially, for the geometric fields, there is nothing that deals with them in json schema, so that could be a bit hard to do.

For really simple cases, I believe we should accept JSON Schema definitions, and that would make us open to a list of services that already support this formalism.

However, that's in my opinion a separate issue. In this one, I think we should focus on outputing a json schema from a daybed (colander) definition.

@almet
Copy link
Member Author

almet commented Aug 25, 2014

for now, mimetype is application/schema+json

@almet
Copy link
Member Author

almet commented Aug 25, 2014

@leplatrem do you have any idea how we can deal with geographic fields here?

@leplatrem
Copy link
Contributor

I found only one example, and it looks pretty complete : https://github.com/fge/sample-json-schemas/blob/master/geojson/geometry.json

In Daybed we have a geojson geometry field (as above), and some basic geo fields that could be described with the positions part only (coordinates only)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants