Title: [Feature]: Auto-detect `base_uri` when using `OpenAPI.from_file_path` · Issue #801 · python-openapi/openapi-core · GitHub
Open Graph Title: [Feature]: Auto-detect `base_uri` when using `OpenAPI.from_file_path` · Issue #801 · python-openapi/openapi-core
X Title: [Feature]: Auto-detect `base_uri` when using `OpenAPI.from_file_path` · Issue #801 · python-openapi/openapi-core
Description: Suggested Behavior When I create an OpenAPI instance with a multi-file schema, I find myself writing: spec_path = "path/to/spec.yaml" openapi = openapi_core.OpenAPI.from_file_path( spec_path, config=openapi_core.Config(spec_base_uri=Path...
Open Graph Description: Suggested Behavior When I create an OpenAPI instance with a multi-file schema, I find myself writing: spec_path = "path/to/spec.yaml" openapi = openapi_core.OpenAPI.from_file_path( spec_path, confi...
X Description: Suggested Behavior When I create an OpenAPI instance with a multi-file schema, I find myself writing: spec_path = "path/to/spec.yaml" openapi = openapi_core.OpenAPI.from_file_path( spec_p...
Opengraph URL: https://github.com/python-openapi/openapi-core/issues/801
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Feature]: Auto-detect `base_uri` when using `OpenAPI.from_file_path`","articleBody":"### Suggested Behavior\n\nWhen I create an OpenAPI instance with a multi-file schema, I find myself writing:\r\n```python\r\nspec_path = \"path/to/spec.yaml\"\r\nopenapi = openapi_core.OpenAPI.from_file_path(\r\n spec_path,\r\n config=openapi_core.Config(spec_base_uri=Path(spec_path).as_uri()),\r\n)\r\n```\r\nThis feels redundant as the implementation for `SchemaPath.from_file_path` also loads the `base_uri`, but that information is then lost:\r\nhttps://github.com/p1c2u/jsonschema-path/blob/f35bd22aa5a0b86fa4c194e47a29aa46908b0d10/jsonschema_path/paths.py#L86\n\n### Why is this needed?\n\nIdeally I would write the above as:\r\n```python\r\nspec_path = \"path/to/spec.yaml\"\r\nopenapi = openapi_core.OpenAPI.from_file_path(spec_path)\r\n```\r\nand the `spec_base_uri` would be correctly set.\r\n\r\nThe `base_uri` is technically available but is private, e.g.:\r\n```python\r\nbase_uri = openapi.spec.accessor.resolver._base_uri\r\n```\n\n### References\n\n_No response_\n\n### Would you like to implement a feature?\n\nNone","author":{"url":"https://github.com/jonathanberthias","@type":"Person","name":"jonathanberthias"},"datePublished":"2024-03-01T14:20:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/801/openapi-core/issues/801"}
| 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:4e71a25f-48e9-15a5-995a-e8189d68abca |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ED24:1E48CC:A84CAF:E1FE11:6977E95E |
| html-safe-nonce | aea69059c13fe3ed8dfa08a02fb3fb11c2e3d4f9ca3538c21fc53528fb990eb8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDI0OjFFNDhDQzpBODRDQUY6RTFGRTExOjY5NzdFOTVFIiwidmlzaXRvcl9pZCI6IjY1MDA4MTgwOTUzMjgxOTI4NjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2c9854488474e4438d99a1af35e1508e25ac85da0d04e2b279c9022930def184 |
| hovercard-subject-tag | issue:2163516092 |
| 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/801/issue_layout |
| twitter:image | https://opengraph.githubassets.com/12af5a4da4eaa490508a74c6faf6e4d893fc7ee6752d1b7dfb6b9474448d8322/python-openapi/openapi-core/issues/801 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/12af5a4da4eaa490508a74c6faf6e4d893fc7ee6752d1b7dfb6b9474448d8322/python-openapi/openapi-core/issues/801 |
| og:image:alt | Suggested Behavior When I create an OpenAPI instance with a multi-file schema, I find myself writing: spec_path = "path/to/spec.yaml" openapi = openapi_core.OpenAPI.from_file_path( spec_path, confi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jonathanberthias |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7eaaff248df7c1f4041c54b7590a56b5684599fefe7ab3647a01863fcc3f017a |
| 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 | 25fe115ee1f8e1f2769ecde97c7c00c068519c2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width