René's URL Explorer Experiment


Title: [Bug]: Does Not Support Binary Response Types · Issue #245 · python-openapi/openapi-schema-validator · GitHub

Open Graph Title: [Bug]: Does Not Support Binary Response Types · Issue #245 · python-openapi/openapi-schema-validator

X Title: [Bug]: Does Not Support Binary Response Types · Issue #245 · python-openapi/openapi-schema-validator

Description: Actual Behavior I hacked together the code below so that I could test this library in isolation, but for context we are using it inside of a Pyramid app. When I run the case below, I get the following exception: openapi_core.validation.r...

Open Graph Description: Actual Behavior I hacked together the code below so that I could test this library in isolation, but for context we are using it inside of a Pyramid app. When I run the case below, I get the follow...

X Description: Actual Behavior I hacked together the code below so that I could test this library in isolation, but for context we are using it inside of a Pyramid app. When I run the case below, I get the follow...

Opengraph URL: https://github.com/python-openapi/openapi-schema-validator/issues/245

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Does Not Support Binary Response Types","articleBody":"### Actual Behavior\r\n\r\nI hacked together the code below so that I could test this library in isolation, but for context we are using it inside of a Pyramid app. When I run the case below, I get the following exception:\r\n\r\n```\r\nopenapi_core.validation.response.exceptions.InvalidData: InvalidData: Value b'\u003cpdf_content\u003e' not valid for schema of type string: (\u003cValidationError: \"b'\u003cpdf_content\u003e' is not of type 'string'\"\u003e,)\r\n```\r\n\r\nIf I then try to wrap it inside of a `str()`, I get `is not of type 'binary'` so I believe there is an issue with the formatter understanding the bytes as a string.\r\n\r\n\r\n### Expected Behavior\r\n\r\nIf I return a binary object (pdf file) it should pass validation.\r\n\r\n### Steps to Reproduce\r\n\r\n\r\n```python\r\nimport typing as t\r\n\r\nfrom openapi_core import OpenAPI\r\nfrom openapi_core.validation.request.datatypes import RequestParameters\r\n\r\n\r\nclass OpenAPIRequest:\r\n    def __init__(self) -\u003e None:\r\n        self.parameters = RequestParameters(\r\n            path={},\r\n            query={},\r\n            header={},\r\n            cookie={},\r\n        )\r\n\r\n    @property\r\n    def host_url(self) -\u003e str:\r\n        return \"https://example.com\"\r\n\r\n    @property\r\n    def path(self) -\u003e str:\r\n        return \"/test\"\r\n\r\n    @property\r\n    def path_pattern(self) -\u003e str:\r\n        return \"/test\"\r\n\r\n    @property\r\n    def method(self) -\u003e str:\r\n        return \"get\"\r\n\r\n    @property\r\n    def body(self) -\u003e t.Optional[t.Union[bytes, str, t.Dict]]:\r\n        return None\r\n\r\n    @property\r\n    def content_type(self) -\u003e str:\r\n        return \"\"\r\n\r\n    @property\r\n    def mimetype(self) -\u003e str:\r\n        return \"\"\r\n\r\n\r\nclass OpenAPIResponse:\r\n    def __init__(self, data: any) -\u003e None:\r\n        self._data = data\r\n\r\n    @property\r\n    def data(self) -\u003e t.Optional[bytes]:\r\n        return self._data\r\n\r\n    @property\r\n    def status_code(self) -\u003e int:\r\n        return 200\r\n\r\n    @property\r\n    def content_type(self) -\u003e str:\r\n        return \"application/pdf\"\r\n\r\n    @property\r\n    def mimetype(self) -\u003e str:\r\n        return \"application/pdf\"\r\n\r\n    @property\r\n    def headers(self) -\u003e t.Mapping[str, t.Any]:\r\n        return {\r\n            \"Content-Type\": \"application/pdf\",\r\n            \"Content-Disposition\": \"attachment; filename=invoice.pdf\",\r\n        }\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    with open('example-pdf.pdf', 'rb') as f:\r\n        pdf_content = f.read()\r\n\r\n    open_api_spec = OpenAPI.from_dict({\r\n        \"openapi\": \"3.1.0\",\r\n        \"info\": {\r\n            \"title\": \"Test spec\",\r\n            \"version\": \"1.0.0\",\r\n            \"description\": \"Test spec\",\r\n        },\r\n        \"servers\": [\r\n            {\"url\": \"https://example.com\"},\r\n        ],\r\n        \"paths\": {\r\n            \"/test\": {\r\n                \"get\": {\r\n                    \"responses\": {\r\n                        \"200\": {\r\n                            \"description\": \"OK\",\r\n                            \"content\": {\r\n                                \"application/pdf\": {\r\n                                    \"schema\": {\r\n                                        \"type\": \"string\",\r\n                                        \"format\": \"binary\",\r\n                                    },\r\n                                },\r\n                            },\r\n                        },\r\n                    },\r\n                },\r\n            }\r\n        }\r\n    })\r\n\r\n    request = OpenAPIRequest()\r\n    response = OpenAPIResponse(data=pdf_content)\r\n    open_api_spec.validate_response(request=request, response=response)\r\n```\r\n\r\n### OpenAPI Core Version\r\n\r\n0.19.1\r\n\r\n### OpenAPI Core Integration\r\n\r\nNatively using openapi-core\r\n\r\n### Affected Area(s)\r\n\r\nValidation\r\n\r\n### References\r\n\r\n_No response_\r\n\r\n### Anything else we need to know?\r\n\r\n_No response_\r\n\r\n### Would you like to implement a fix?\r\n\r\nNone","author":{"url":"https://github.com/its-hammer-time","@type":"Person","name":"its-hammer-time"},"datePublished":"2024-06-13T22:00:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/245/openapi-schema-validator/issues/245"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:ef1b981f-3714-af8c-86b2-3494f939fa09
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC022:3E913B:19F6CF5:24118D1:69778449
html-safe-nonce32f5ac204f1ac3b96b0721380d7b19914cec8a9078fe8f658fc6bd103dd23b63
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDIyOjNFOTEzQjoxOUY2Q0Y1OjI0MTE4RDE6Njk3Nzg0NDkiLCJ2aXNpdG9yX2lkIjoiNzgwMjcxMTEzNzU5NzIyODEwNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac135dc5df2f5a8c1944f796f950ca96c66e7845045401f00eddd14c077a60b6ce
hovercard-subject-tagissue:3748016845
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-openapi/openapi-schema-validator/245/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3c25b4894d6e60e5cf1d237a84357174597dcb5d3d7aabdd329e2d735628e65d/python-openapi/openapi-schema-validator/issues/245
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3c25b4894d6e60e5cf1d237a84357174597dcb5d3d7aabdd329e2d735628e65d/python-openapi/openapi-schema-validator/issues/245
og:image:altActual Behavior I hacked together the code below so that I could test this library in isolation, but for context we are using it inside of a Pyramid app. When I run the case below, I get the follow...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameits-hammer-time
hostnamegithub.com
expected-hostnamegithub.com
Nonefd37f8e74ecc49b700617ea694fa6d7b395b6c9a4b79c59b3014da220462ac69
turbo-cache-controlno-preview
go-importgithub.com/python-openapi/openapi-schema-validator git https://github.com/python-openapi/openapi-schema-validator.git
octolytics-dimension-user_id126442889
octolytics-dimension-user_loginpython-openapi
octolytics-dimension-repository_id245119225
octolytics-dimension-repository_nwopython-openapi/openapi-schema-validator
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id245119225
octolytics-dimension-repository_network_root_nwopython-openapi/openapi-schema-validator
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release523f6485bbeeb9958ec03260b225e9183734585d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/issues/245#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-openapi%2Fopenapi-schema-validator%2Fissues%2F245
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-openapi%2Fopenapi-schema-validator%2Fissues%2F245
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python-openapi%2Fopenapi-schema-validator
Reloadhttps://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/issues/245
Reloadhttps://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/issues/245
Reloadhttps://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/issues/245
python-openapi https://patch-diff.githubusercontent.com/python-openapi
openapi-schema-validatorhttps://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator
Please reload this pagehttps://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/issues/245
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fpython-openapi%2Fopenapi-schema-validator
Fork 35 https://patch-diff.githubusercontent.com/login?return_to=%2Fpython-openapi%2Fopenapi-schema-validator
Star 122 https://patch-diff.githubusercontent.com/login?return_to=%2Fpython-openapi%2Fopenapi-schema-validator
Code https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator
Issues 13 https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/issues
Pull requests 11 https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/pulls
Discussions https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/discussions
Actions https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/actions
Projects 0 https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/projects
Security 0 https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/security
Insights https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/pulse
Code https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator
Issues https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/issues
Pull requests https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/pulls
Discussions https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/discussions
Actions https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/actions
Projects https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/projects
Security https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/security
Insights https://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/python-openapi/openapi-schema-validator/issues/245
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/python-openapi/openapi-schema-validator/issues/245
[Bug]: Does Not Support Binary Response Typeshttps://patch-diff.githubusercontent.com/python-openapi/openapi-schema-validator/issues/245#top
https://github.com/its-hammer-time
https://github.com/its-hammer-time
its-hammer-timehttps://github.com/its-hammer-time
on Jun 13, 2024https://github.com/python-openapi/openapi-schema-validator/issues/245#issue-3748016845
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.