Title: Validate doesnt seem to match schema correctly? · Issue #136 · python-openapi/openapi-schema-validator · GitHub
Open Graph Title: Validate doesnt seem to match schema correctly? · Issue #136 · python-openapi/openapi-schema-validator
X Title: Validate doesnt seem to match schema correctly? · Issue #136 · python-openapi/openapi-schema-validator
Description: I am using validate against API responses. validate(openapi_schema_path, response.json()) seems to work on many of the apis. But when the api returns something like: {"items":[4,5,6,1,2]} which is an object with items property and an arr...
Open Graph Description: I am using validate against API responses. validate(openapi_schema_path, response.json()) seems to work on many of the apis. But when the api returns something like: {"items":[4,5,6,1,2]} which is ...
X Description: I am using validate against API responses. validate(openapi_schema_path, response.json()) seems to work on many of the apis. But when the api returns something like: {"items":[4,5,6,1,2]}...
Opengraph URL: https://github.com/python-openapi/openapi-schema-validator/issues/136
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Validate doesnt seem to match schema correctly?","articleBody":"I am using validate against API responses.\r\n\r\n```python\r\n validate(openapi_schema_path, response.json())\r\n ```\r\n\r\nseems to work on many of the apis. But when the api returns something like:\r\n```json\r\n{\"items\":[4,5,6,1,2]}\r\n```\r\n\r\nwhich is an object with items property and an array of integers or objects in other cases. The validate throws \r\n```\r\nvalidation failed:\r\n[6, 1, 2, 4, 5] is not of type 'object', 'boolean'\r\n\r\nFailed validating 'type' in metaschema['allOf'][1]['properties']['items']['$dynamicRef']['allOf'][0]:\r\n {'$defs': {'anchorString': {'pattern': '^[A-Za-z_][-A-Za-z0-9._]*$',\r\n 'type': 'string'},\r\n 'uriReferenceString': {'format': 'uri-reference',\r\n 'type': 'string'},\r\n 'uriString': {'format': 'uri', 'type': 'string'}},\r\n '$dynamicAnchor': 'meta',\r\n '$id': 'https://json-schema.org/draft/2020-12/meta/core',\r\n '$schema': 'https://json-schema.org/draft/2020-12/schema',\r\n '$vocabulary': {'https://json-schema.org/draft/2020-12/vocab/core': True},\r\n 'properties': {'$anchor': {'$ref': '#/$defs/anchorString'},\r\n '$comment': {'type': 'string'},\r\n '$defs': {'additionalProperties': {'$dynamicRef': '#meta'},\r\n 'type': 'object'},\r\n '$dynamicAnchor': {'$ref': '#/$defs/anchorString'},\r\n '$dynamicRef': {'$ref': '#/$defs/uriReferenceString'},\r\n '$id': {'$comment': 'Non-empty fragments not allowed.',\r\n '$ref': '#/$defs/uriReferenceString',\r\n 'pattern': '^[^#]*#?$'},\r\n '$ref': {'$ref': '#/$defs/uriReferenceString'},\r\n '$schema': {'$ref': '#/$defs/uriString'},\r\n '$vocabulary': {'additionalProperties': {'type': 'boolean'},\r\n 'propertyNames': {'$ref': '#/$defs/uriString'},\r\n 'type': 'object'}},\r\n 'title': 'Core vocabulary meta-schema',\r\n 'type': ['object', 'boolean']}\r\n\r\nOn schema['items']:\r\n [6, 1, 2, 4, 5]\r\n```\r\n\r\nthe schema is defined as \r\n```yaml\r\nmethods:\r\n type: object\r\n properties:\r\n items:\r\n type: array\r\n items:\r\n type: integer\r\n```\r\nwhich matches the actual response.\r\n\r\nAm i doing something wrong with validate?","author":{"url":"https://github.com/dicolanl","@type":"Person","name":"dicolanl"},"datePublished":"2023-10-11T14:29:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/136/openapi-schema-validator/issues/136"}
| 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:05470195-b0d6-202c-ff1b-6a937b3e6642 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF34:2EE6B2:2A4FA3D:38A8AF8:697AD24E |
| html-safe-nonce | e65531cffd267dc4620ff0460e1491540864ad4d8561827e48a53e2834a3f4e7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjM0OjJFRTZCMjoyQTRGQTNEOjM4QThBRjg6Njk3QUQyNEUiLCJ2aXNpdG9yX2lkIjoiNTI3NjAzMDA3OTc3ODYwNzY5NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 66d6abbf364d7be219a4e5806835bacf6b607edb1462bdfc4a838450676ef4fa |
| hovercard-subject-tag | issue:1937936199 |
| 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-schema-validator/136/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9ae110347735198d3453f66c5f0b43236474bb58c0e0a1f20111e6150dc7b889/python-openapi/openapi-schema-validator/issues/136 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9ae110347735198d3453f66c5f0b43236474bb58c0e0a1f20111e6150dc7b889/python-openapi/openapi-schema-validator/issues/136 |
| og:image:alt | I am using validate against API responses. validate(openapi_schema_path, response.json()) seems to work on many of the apis. But when the api returns something like: {"items":[4,5,6,1,2]} which is ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dicolanl |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4af1ba0e68200258a80b0c5ab34f12a78bf48372a377a11e14eb668863c03b3a |
| turbo-cache-control | no-preview |
| go-import | github.com/python-openapi/openapi-schema-validator git https://github.com/python-openapi/openapi-schema-validator.git |
| octolytics-dimension-user_id | 126442889 |
| octolytics-dimension-user_login | python-openapi |
| octolytics-dimension-repository_id | 245119225 |
| octolytics-dimension-repository_nwo | python-openapi/openapi-schema-validator |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 245119225 |
| octolytics-dimension-repository_network_root_nwo | python-openapi/openapi-schema-validator |
| 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 | 353b231ffaec2de44db15b2e82887804ede7c21e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width