Can Mimesis use JSON Schema? #1312
Replies: 2 comments
-
I'm not quite sure I get the question. Can you please show a code sample? What kind of API do expect to be implemented? |
Beta Was this translation helpful? Give feedback.
-
I'm talking about some kind of internal conversation of a JSON schema specification to a Mimesis schema. So, for example, imagine a JSON Schema that looks like this (in YAML for compactness: title: example-schema
type: object
properties:
pk:
type: integer
uid:
type: string
format: uuid
name:
type: string
version:
type: string
pattern: '^[1-9]+\.[1-9]+\.[1-9]+.*$'
timestamp:
type: string
format: date-time
owner:
type: object
properties:
email:
type: string
format: email
token:
type: string
creator:
type: string
required:
- email
- token
- creator
required:
- pk
- uid
- name
- version
- timestamp
- owner This schema could be relatively straighforwardly converted to the one in Mimesis documentation. There are a few options for such an API; one would be to run it in two steps, first making the conversion into a form that could be passed to Mimesis, and the the second doing the actual conversion. Another option would be converting the JSON schema elements into Mimesis fields on the fly, at runtime. 🤔 |
Beta Was this translation helpful? Give feedback.
-
After briefly looking through the documentation I'm assuming the answer is "no", but it's still worth asking: can Mimesis use JSON Schema as the basis for defining schemas? If not, are there any methods (converters, plugins...) that can be used to implement that? Thank you!
Beta Was this translation helpful? Give feedback.
All reactions