Title: UnmarshallerError if specifying `format` with `type: [foo, 'null']` · Issue #483 · python-openapi/openapi-core · GitHub
Open Graph Title: UnmarshallerError if specifying `format` with `type: [foo, 'null']` · Issue #483 · python-openapi/openapi-core
X Title: UnmarshallerError if specifying `format` with `type: [foo, 'null']` · Issue #483 · python-openapi/openapi-core
Description: I'm still working on minimal reproducer to prove this out so apologies for the lack of a one in advance. I've got a schema like this: openapi: '3.1.0' # ... components: schemas: PatchList: type: 'object' properties: # ... pull_url: title...
Open Graph Description: I'm still working on minimal reproducer to prove this out so apologies for the lack of a one in advance. I've got a schema like this: openapi: '3.1.0' # ... components: schemas: PatchList: type: 'o...
X Description: I'm still working on minimal reproducer to prove this out so apologies for the lack of a one in advance. I've got a schema like this: openapi: '3.1.0' # ... components: schemas: Pat...
Opengraph URL: https://github.com/python-openapi/openapi-core/issues/483
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"UnmarshallerError if specifying `format` with `type: [foo, 'null']`","articleBody":"I'm still working on minimal reproducer to prove this out so apologies for the lack of a one in advance.\r\n\r\nI've got a schema like this:\r\n\r\n```yaml\r\nopenapi: '3.1.0'\r\n# ...\r\ncomponents:\r\n schemas:\r\n PatchList:\r\n type: 'object'\r\n properties:\r\n # ...\r\n pull_url:\r\n title: 'Pull URL'\r\n type:\r\n - 'string'\r\n - 'null'\r\n format: 'uri'\r\n maxLength: 255\r\n # ...\r\n```\r\n\r\nIf my server returns a response with `pull_url` set to `null`, then the call to `openapi_core.validation.response.validators.ResponseValidator.validate` fails with the following traceback:\r\n\r\n```python\r\nTraceback (most recent call last):\r\n File \"/dev/patchwork/patchwork/tests/api/test_relation.py\", line 267, in test_remove_one_patch_from_relation_good\r\n resp = self.client.patch(\r\n File \"/dev/patchwork/patchwork/tests/api/utils.py\", line 241, in patch\r\n validator.validate_data(\r\n File \"/dev/patchwork/patchwork/tests/api/validator.py\", line 141, in validate_data\r\n result.raise_for_errors()\r\n File \"/dev/openapi-core/openapi_core/validation/datatypes.py\", line 12, in raise_for_errors\r\n raise error\r\n File \"/dev/openapi-core/openapi_core/validation/response/validators.py\", line 245, in validate\r\n data = self._get_data(response, operation_response)\r\n File \"/dev/openapi-core/openapi_core/validation/response/validators.py\", line 88, in _get_data\r\n data = self._unmarshal(schema, casted)\r\n File \"/dev/openapi-core/openapi_core/validation/validators.py\", line 76, in _unmarshal\r\n return unmarshaller(value)\r\n File \"/dev/openapi-core/openapi_core/unmarshalling/schemas/unmarshallers.py\", line 91, in __call__\r\n return self.unmarshal(value)\r\n File \"/dev/openapi-core/openapi_core/unmarshalling/schemas/unmarshallers.py\", line 434, in unmarshal\r\n return unmarshaller.unmarshal(value)\r\n File \"/dev/openapi-core/openapi_core/unmarshalling/schemas/unmarshallers.py\", line 316, in unmarshal\r\n properties = self.format(value)\r\n File \"/dev/openapi-core/openapi_core/unmarshalling/schemas/unmarshallers.py\", line 325, in format\r\n return self._unmarshal_properties(formatted, schema_only=schema_only)\r\n File \"/dev/openapi-core/openapi_core/unmarshalling/schemas/unmarshallers.py\", line 354, in _unmarshal_properties\r\n all_of_properties = self._clone(all_of_schema).format(\r\n File \"/dev/openapi-core/openapi_core/unmarshalling/schemas/unmarshallers.py\", line 325, in format\r\n return self._unmarshal_properties(formatted, schema_only=schema_only)\r\n File \"/dev/openapi-core/openapi_core/unmarshalling/schemas/unmarshallers.py\", line 373, in _unmarshal_properties\r\n properties[prop_name] = self.unmarshallers_factory.create(\r\n File \"/dev/openapi-core/openapi_core/unmarshalling/schemas/unmarshallers.py\", line 91, in __call__\r\n return self.unmarshal(value)\r\n File \"/dev/openapi-core/openapi_core/unmarshalling/schemas/unmarshallers.py\", line 433, in unmarshal\r\n unmarshaller = self._get_best_unmarshaller(value)\r\n File \"/dev/openapi-core/openapi_core/unmarshalling/schemas/unmarshallers.py\", line 430, in _get_best_unmarshaller\r\n raise UnmarshallerError(\"Unmarshaller not found for type(s)\")\r\nopenapi_core.unmarshalling.schemas.exceptions.UnmarshallerError: Unmarshaller not found for type(s)\r\n```\r\n\r\nIf I comment out `format`, things work as expected. I suspect it's attempting to apply a formatter for the null values. As far as I can tell, this should work though.","author":{"url":"https://github.com/stephenfin","@type":"Person","name":"stephenfin"},"datePublished":"2023-01-24T16:44:06.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/483/openapi-core/issues/483"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:989a3ffe-55b3-8de9-b26b-4f8c3f86cea2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EC14:206EAE:87D6AB:B371D4:697835E5 |
| html-safe-nonce | 082a9b7879bce66382836d47f8df395135a769f4eec6342c8305e563d6103158 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzE0OjIwNkVBRTo4N0Q2QUI6QjM3MUQ0OjY5NzgzNUU1IiwidmlzaXRvcl9pZCI6IjY3MzM2MzYwMjMxOTc2NDQyNjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c446c7875fbb0487c3d7b297b04e531ea47e2d0d20c3e0144a92872498f5018d |
| hovercard-subject-tag | issue:1555313363 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-openapi/openapi-core/483/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fd9acf84b315239d14c5b9ee267487657371ef9581cf8670fb754e3948355ce1/python-openapi/openapi-core/issues/483 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fd9acf84b315239d14c5b9ee267487657371ef9581cf8670fb754e3948355ce1/python-openapi/openapi-core/issues/483 |
| og:image:alt | I'm still working on minimal reproducer to prove this out so apologies for the lack of a one in advance. I've got a schema like this: openapi: '3.1.0' # ... components: schemas: PatchList: type: 'o... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | stephenfin |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2981c597c945c1d90ac6fa355ce7929b2f413dfe7872ca5c435ee53a24a1de50 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-openapi/openapi-core git https://github.com/python-openapi/openapi-core.git |
| octolytics-dimension-user_id | 126442889 |
| octolytics-dimension-user_login | python-openapi |
| octolytics-dimension-repository_id | 104200746 |
| octolytics-dimension-repository_nwo | python-openapi/openapi-core |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 104200746 |
| octolytics-dimension-repository_network_root_nwo | python-openapi/openapi-core |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8cc3e064910e26648760f573a358cfc07c97b42c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width