cwacek / python-jsonschema-objects

Automatic Python binding generation from JSON Schemas
MIT License
363 stars 96 forks source link

Update README.md #291

Closed seanreed1111 closed 1 day ago

seanreed1111 commented 4 months ago

updates readme. Seems like usage changed over the years from builder = pjs.ObjectBuilder(examples['Example Schema'])

to

builder = pjs.ObjectBuilder(examples)

The former gives the following error:

`KeyError Traceback (most recent call last) in <cell line: 2>() 1 import python_jsonschema_objects as pjs ----> 2 builder = pjs.ObjectBuilder(example["Example Schema"]) 3 ns = builder.build_classes() 4 Person = ns.ExampleSchema 5 james = Person(firstName="James", lastName="Bond")

KeyError: 'Example Schema'`

cwacek commented 1 day ago

The examples in the README are actually tests, so they're correct. The ObjectBuilder wants a single schema anyway, not a set of schemas, so we'd expect a single example to be passed in.

seanreed1111 commented 1 day ago

ok cool, got it. That wasn't so clear.

On Mon, Nov 11, 2024 at 4:21 PM Chris W @.***> wrote:

The examples in the README are actually tests, so they're correct. The ObjectBuilder wants a single schema anyway, not a set of schemas, so we'd expect a single example to be passed in.

— Reply to this email directly, view it on GitHub https://github.com/cwacek/python-jsonschema-objects/pull/291#issuecomment-2469040808, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLZN7RHHKXXEMQQ6OKF7AD2AENXDAVCNFSM6AAAAABK2WRTSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRZGA2DAOBQHA . You are receiving this because you authored the thread.Message ID: @.***>