polyfactory icon indicating copy to clipboard operation
polyfactory copied to clipboard

Enhancement: factory from json schema

Open Goldziher opened this issue 1 year ago • 3 comments

Summary

Hiya strangers,

I work a lot with schemas these days, and its in general a pain to generate good quality values for them. Polyfactory is a great option for this.

Basic Example

from referencing.jsonschema import DRAFT202012

class MySchemaFactory(SchemaFactory[DRAFT202012]):
    __schema__ = "schemas/my_schema.yaml"

Drawbacks and Impact

None to my knowledge. Its possible not to use referencing for this, but this library is used in jsonschema as well. So I think its a good dependency.

Unresolved questions

Nope

Goldziher avatar Jul 21 '24 17:07 Goldziher

@adhtruong hi there. any chanec of implementing this for v3? would be very nice to have this.

Goldziher avatar Mar 23 '25 20:03 Goldziher

Hey @Goldziher, I'll unlikley to find time to implement myself but happy to review PRs for this!

I want to focus on v3 and given it's new functionality imagine it'll be fine to be in new base factory so should be able to be on either side of v3

adhtruong avatar Mar 24 '25 20:03 adhtruong

I am ready to implement this task.

Rub1kCube avatar Jun 23 '25 12:06 Rub1kCube