Closed PetarIvancevic closed 3 years ago
@PetarIvancevic Thanks for the PR. Could you also update the sample in fixtures and the generated output? I still cannot imagine your use case and what the json schema looks like. If the pattern is a regex, this serves as one json schema field?
@PetarIvancevic
The PR seems good.
The question in my mind is that an "/s/" field in dynamicKeyHolder in the JSON schema is really helpful to you? I cannot imagine how you can validate your JSON using this schema. Do you have a custom JSON schema validator? Or any standard JSON schema validator can do that?
On a project we have an object that has dynamic keys depending on the ids that are assigned. The ids are strings and they are objects which have a defined schema. For documentation purposes we require these fields to be documented. Using joi I made a small recursive function to go through your JSON output of the joi schema and define fields to populate in a table :)
Hi @PetarIvancevic,
I am wondering if your scenario of dynamic key should be using patternProperties
as shown in this documentation
Adding support for dynamic keys as described here https://github.com/kenspirit/joi-to-json/issues/10