oprogramador / json-schema-faker-cli

A CLI for json-schema-faker.
28 stars 12 forks source link

generate-json schema.json output.json not working with faker values #48

Closed fredyfredburger closed 11 months ago

fredyfredburger commented 11 months ago

I don't know if I'm just doing this wrong, but I can't seem to get faker providers to work. I've tested this on the web GUI to make sure the schema works as intended, but when running in the CLI it keeps outputting lorem ipsum not what the faker provider should output.

Here is the schema I'm using:

{
  "type": "object",
  "properties": {
    "test": {
      "type": "string",
      "faker": {
        "fake": "{{address.country}}"
      }
    }
  },
  "required": [
    "test"
  ]
}
fredyfredburger commented 11 months ago

If it helps, I'm just putting that JSON schema into a schema.json file, then running:

generate-json schema.json output.json

The result outputs the test field in a json object, but just lorem ipsum not a random country.

oprogramador commented 11 months ago

Thanks for reporting this. I'm not sure when I find time to fix that or to provide any guidelines.

Could you post some screenshots showing how this tool fails, and how it works in another place?

fredyfredburger commented 11 months ago

Working notWorking

fredyfredburger commented 11 months ago

I found a work-around. I can just spin up json-schema-server and use it from the cmd line with wget. All I need is for faker values and pattern properties to both work. The python port of the JSF library doesn't support pattern properties, and the jsf-cli doesn't support calls to the faker-js library. The json-schema-server supports both, so this issue can be closed. Thanks!