Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default fields not declared on Object #57

Open
dmvieira opened this issue Mar 2, 2020 · 1 comment · May be fixed by #68
Open

Default fields not declared on Object #57

dmvieira opened this issue Mar 2, 2020 · 1 comment · May be fixed by #68

Comments

@dmvieira
Copy link

dmvieira commented Mar 2, 2020

Got KeyError referring to schema object with default value:

import warlock

schema = {
  "title": "Message",
  "type": "object",
  "properties": {
    "sender": {
      "title": "Sender",
      "type": "string"
    },
    "trace": {
      "title": "Trace",
      "default": [],
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "sender"
  ],
  'additionalProperties': True
}

Message = warlock.model_factory(schema)
m = Message(sender="who")

m.trace # got error
@minelminel
Copy link

Experiencing this same issue myself, I can confirm by examining the test cases that there is no coverage for this behavior. I'm willing to put together a PR to handle this if one does not already exist on a fork somewhere.

@SolidTux SolidTux linked a pull request Jun 5, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants