forked from Azure/azure-cli-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: enable openapi spec from url in api register #74
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
41cc197
feat: enable openapi spec from url in api register
frankqianms c31cdfd
refactor: set spec definition as link format when link provided
frankqianms dbcee85
fix: fix style
frankqianms da16917
test: add error handling case for testing invalid spec url
frankqianms 6447dc1
fix: fix test case
frankqianms 172e1d2
fix: use 404 response url
frankqianms 1c987ed
test: update case
frankqianms f518e27
test: update test case
frankqianms d507d9d
refactor: update error logic
frankqianms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
154 changes: 154 additions & 0 deletions
154
..._extension/tests/latest/recordings/test_register_using_spec_url_with_invalid_content.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,154 @@ | ||
| interactions: | ||
| - request: | ||
| body: null | ||
| headers: | ||
| Accept: | ||
| - '*/*' | ||
| Accept-Encoding: | ||
| - gzip, deflate | ||
| Connection: | ||
| - keep-alive | ||
| User-Agent: | ||
| - python-requests/2.32.3 | ||
| method: GET | ||
| uri: https://github.com/ | ||
| response: | ||
| body: | ||
| string: '!!! The response body has been omitted from the recording because it | ||
| is larger than 128 KB. It will be replaced with blank content of 254684 bytes | ||
| while replay. <CTRL-REPLACE>254684' | ||
| headers: | ||
| accept-ranges: | ||
| - bytes | ||
| cache-control: | ||
| - max-age=0, private, must-revalidate | ||
| content-language: | ||
| - en-US | ||
| content-length: | ||
| - '181' | ||
| content-security-policy: | ||
| - 'default-src ''none''; base-uri ''self''; child-src github.com/assets-cdn/worker/ | ||
| github.com/webpack/ github.com/assets/ gist.github.com/assets-cdn/worker/; | ||
| connect-src ''self'' uploads.github.com www.githubstatus.com collector.github.com | ||
| raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com | ||
| github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com | ||
| *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com | ||
| objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com | ||
| proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com | ||
| wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ | ||
| productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ | ||
| productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ | ||
| productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ | ||
| productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ | ||
| productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ | ||
| productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ | ||
| productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ | ||
| productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ | ||
| productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ | ||
| productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com | ||
| github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com | ||
| wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com | ||
| api.business.githubcopilot.com api.enterprise.githubcopilot.com github.githubassets.com | ||
| edge.fullstory.com rs.fullstory.com; font-src github.githubassets.com; form-action | ||
| ''self'' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; | ||
| frame-ancestors ''none''; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com | ||
| www.youtube-nocookie.com; img-src ''self'' data: blob: github.githubassets.com | ||
| media.githubusercontent.com camo.githubusercontent.com identicons.github.com | ||
| avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com | ||
| objects.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ | ||
| private-user-images.githubusercontent.com opengraph.githubassets.com github-production-user-asset-6210df.s3.amazonaws.com | ||
| customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com | ||
| *.githubusercontent.com; manifest-src ''self''; media-src github.com user-images.githubusercontent.com/ | ||
| secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com | ||
| github-production-user-asset-6210df.s3.amazonaws.com gist.github.com github.githubassets.com; | ||
| script-src github.githubassets.com; style-src ''unsafe-inline'' github.githubassets.com; | ||
| upgrade-insecure-requests; worker-src github.com/assets-cdn/worker/ github.com/webpack/ | ||
| github.com/assets/ gist.github.com/assets-cdn/worker/' | ||
| content-type: | ||
| - text/html; charset=utf-8 | ||
| date: | ||
| - Tue, 15 Oct 2024 04:01:12 GMT | ||
| etag: | ||
| - W/"2a20e14cbb76e542f3c5fed75a897deb" | ||
| referrer-policy: | ||
| - origin-when-cross-origin, strict-origin-when-cross-origin | ||
| server: | ||
| - GitHub.com | ||
| set-cookie: | ||
| - _gh_sess=nDe4UkSl89r%2BcpkpALiHWruZQSCE0K7Fv4fZdUJ16N4E1RiBG7xxX7sfwTTFgEBKMq3qRcEnxXvS3tZOl5yHbg1o2Uda3WqjBs4TNl7cYJI7F6QT5eyX%2FtSiHQYzoxuAyhq5e%2F%2Bouf17OSFst%2FoFYupJtDycyzraeIzFF7CY6%2FLMz8AvqcXpf%2FQBM2C0pU%2FZQDG%2F9pdSzk6xumiDwggGAJ1WhMgHSE%2FPWlQIQoPfh%2FF%2FOwIOs7NWfq6d5zkw0tcAbzNO%2Fo5x1oL1C7EY88z2%2Bg%3D%3D--DX1tQfpx6VemsBsP--fkxfh8oqGwFOgJFUsVzA5Q%3D%3D; | ||
| Path=/; HttpOnly; Secure; SameSite=Lax | ||
| - _octo=GH1.1.1313912529.1728964875; Path=/; Domain=github.com; Expires=Wed, | ||
| 15 Oct 2025 04:01:15 GMT; Secure; SameSite=Lax | ||
| - logged_in=no; Path=/; Domain=github.com; Expires=Wed, 15 Oct 2025 04:01:15 | ||
| GMT; HttpOnly; Secure; SameSite=Lax | ||
| strict-transport-security: | ||
| - max-age=31536000; includeSubdomains; preload | ||
| transfer-encoding: | ||
| - chunked | ||
| vary: | ||
| - X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Language, Accept-Encoding, | ||
| Accept, X-Requested-With | ||
| x-content-type-options: | ||
| - nosniff | ||
| x-frame-options: | ||
| - deny | ||
| x-github-request-id: | ||
| - 0806:21A5DE:29131BD:2D8EF81:670DE90B | ||
| x-xss-protection: | ||
| - '0' | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| - request: | ||
| body: null | ||
| headers: | ||
| Accept: | ||
| - application/json | ||
| Accept-Encoding: | ||
| - gzip, deflate | ||
| CommandName: | ||
| - apic api show | ||
| Connection: | ||
| - keep-alive | ||
| ParameterSetName: | ||
| - -g -n --api-id | ||
| User-Agent: | ||
| - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) | ||
| method: GET | ||
| uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore?api-version=2024-03-01 | ||
| response: | ||
| body: | ||
| string: '{"code":"404"}' | ||
| headers: | ||
| api-supported-versions: | ||
| - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview | ||
| cache-control: | ||
| - no-cache | ||
| content-length: | ||
| - '14' | ||
| content-type: | ||
| - application/json; charset=utf-8 | ||
| date: | ||
| - Tue, 15 Oct 2024 04:01:16 GMT | ||
| expires: | ||
| - '-1' | ||
| pragma: | ||
| - no-cache | ||
| strict-transport-security: | ||
| - max-age=31536000; includeSubDomains | ||
| vary: | ||
| - Accept-Encoding | ||
| x-cache: | ||
| - CONFIG_NOCACHE | ||
| x-content-type-options: | ||
| - nosniff | ||
| x-ms-ratelimit-remaining-subscription-global-reads: | ||
| - '16499' | ||
| x-msedge-ref: | ||
| - 'Ref A: F157DB4EBD6E442D94239BD1D1EBFE1A Ref B: MAA201060513023 Ref C: 2024-10-15T04:01:15Z' | ||
| x-powered-by: | ||
| - ASP.NET | ||
| status: | ||
| code: 404 | ||
| message: Not Found | ||
| version: 1 |
109 changes: 109 additions & 0 deletions
109
...ion/azext_apic_extension/tests/latest/recordings/test_register_with_invalid_spec_url.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| interactions: | ||
| - request: | ||
| body: null | ||
| headers: | ||
| Accept: | ||
| - '*/*' | ||
| Accept-Encoding: | ||
| - gzip, deflate | ||
| Connection: | ||
| - keep-alive | ||
| User-Agent: | ||
| - python-requests/2.32.3 | ||
| method: GET | ||
| uri: https://github.com/invalidrepo | ||
| response: | ||
| body: | ||
| string: Not Found | ||
| headers: | ||
| cache-control: | ||
| - no-cache | ||
| content-length: | ||
| - '9' | ||
| content-security-policy: | ||
| - default-src 'none'; base-uri 'self'; connect-src 'self'; form-action 'self'; | ||
| img-src 'self' data:; script-src 'self'; style-src 'unsafe-inline' | ||
| content-type: | ||
| - text/plain; charset=utf-8 | ||
| date: | ||
| - Tue, 15 Oct 2024 04:01:14 GMT | ||
| referrer-policy: | ||
| - origin-when-cross-origin, strict-origin-when-cross-origin | ||
| server: | ||
| - GitHub.com | ||
| set-cookie: | ||
| - _gh_sess=05a6i77a0k6QZ7mJnH%2BnWIliR5guipRh0Z%2Fs73RhXbNuLqVAnKu19dDhM1kWOhpwMFe8ZSuBFfzUJOop9ta9yqM6ZL3qs0chytbmyaEh%2F6YELXvhhcXHO1za3tMCbJBynfJ2HGeIRPC1GyepCLgKnyg13K1gRKMbFbxNTUgqERu59BrD%2FNGDDp1bdz4EYNrl5THCBqSX8Ozp%2Foi1ZKPOaJK0LujquBpWJqd7CQ09E9EUxeIqUSeKPPrUv4S41%2B8B9pLJDrHign95vSXBE48xMQ%3D%3D--N%2F4dD85JrQ2c5oY5--X7gxxV%2Bs35GOWsptYdJVPw%3D%3D; | ||
| Path=/; HttpOnly; Secure; SameSite=Lax | ||
| - _octo=GH1.1.98402674.1728964874; Path=/; Domain=github.com; Expires=Wed, 15 | ||
| Oct 2025 04:01:14 GMT; Secure; SameSite=Lax | ||
| - logged_in=no; Path=/; Domain=github.com; Expires=Wed, 15 Oct 2025 04:01:14 | ||
| GMT; HttpOnly; Secure; SameSite=Lax | ||
| strict-transport-security: | ||
| - max-age=31536000; includeSubdomains; preload | ||
| vary: | ||
| - X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, | ||
| X-Requested-With | ||
| x-content-type-options: | ||
| - nosniff | ||
| x-frame-options: | ||
| - deny | ||
| x-github-request-id: | ||
| - 6596:211F6C:2906DAC:2D82A98:670DE90A | ||
| x-xss-protection: | ||
| - '0' | ||
| status: | ||
| code: 404 | ||
| message: Not Found | ||
| - request: | ||
| body: null | ||
| headers: | ||
| Accept: | ||
| - application/json | ||
| Accept-Encoding: | ||
| - gzip, deflate | ||
| CommandName: | ||
| - apic api show | ||
| Connection: | ||
| - keep-alive | ||
| ParameterSetName: | ||
| - -g -n --api-id | ||
| User-Agent: | ||
| - AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.9 (Windows-10-10.0.22631-SP0) | ||
| method: GET | ||
| uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clirg000001/providers/Microsoft.ApiCenter/services/clitest000002/workspaces/default/apis/swaggerpetstore?api-version=2024-03-01 | ||
| response: | ||
| body: | ||
| string: '{"code":"404"}' | ||
| headers: | ||
| api-supported-versions: | ||
| - 2023-07-01-preview, 2024-03-01, 2024-03-15-preview | ||
| cache-control: | ||
| - no-cache | ||
| content-length: | ||
| - '14' | ||
| content-type: | ||
| - application/json; charset=utf-8 | ||
| date: | ||
| - Tue, 15 Oct 2024 04:01:15 GMT | ||
| expires: | ||
| - '-1' | ||
| pragma: | ||
| - no-cache | ||
| strict-transport-security: | ||
| - max-age=31536000; includeSubDomains | ||
| vary: | ||
| - Accept-Encoding | ||
| x-cache: | ||
| - CONFIG_NOCACHE | ||
| x-content-type-options: | ||
| - nosniff | ||
| x-ms-ratelimit-remaining-subscription-global-reads: | ||
| - '16499' | ||
| x-msedge-ref: | ||
| - 'Ref A: F3CFA1D4358D4160A2BCF0E69AEE0789 Ref B: MAA201060515025 Ref C: 2024-10-15T04:01:14Z' | ||
| x-powered-by: | ||
| - ASP.NET | ||
| status: | ||
| code: 404 | ||
| message: Not Found | ||
| version: 1 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.