Skip to content
Discussion options

You must be logged in to vote

Hi @gk12277

Is it possible to add extra keys and values when generating models form jsonschema.

the short answer is no.

Is there a way to specify key1, key2 and values in my schema so that the model is generated as below

Where are key1, key2?
Did you expect this schema?

"$schema": http://json-schema.org/draft-07/schema#
title: Person
type: object
properties:
  firstName:
    type: string
    description: The person's first name.
    key1: 
      a: a1
      b: b1
    key2: aaaa

I can add an option of CLI to pass extra keys to the field.
For example

$ datamodel-codegen --input input.json --extra-keys key1 key2

What do you think about it?

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@gk12277
Comment options

@koxudaxi
Comment options

@koxudaxi
Comment options

@gk12277
Comment options

Answer selected by gk12277
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants