Skip to content
This repository has been archived by the owner on Nov 19, 2023. It is now read-only.

feat: adding url schema loader functionality #283

Merged
merged 2 commits into from
Nov 5, 2022

Conversation

maticardenas
Copy link
Contributor

@maticardenas maticardenas commented Nov 4, 2022

Adding functionality for loading a schema from a url path.

This can be useful for situations where you need to load local tests and you hold schemas in a separate repository / server.

  • Adding UrlStaticSchemaLoader to handle the cast of the schema content.
  • Checking if schema_file_path is an url and assigning corresponding loader accordingly.
  • Adding tests.

This is related to issue #282

@codecov
Copy link

codecov bot commented Nov 4, 2022

Codecov Report

Merging #283 (dd3dda1) into master (ef24951) will increase coverage by 0.0%.
The diff coverage is 100.0%.

@@          Coverage Diff           @@
##           master    #283   +/-   ##
======================================
  Coverage    98.6%   98.7%           
======================================
  Files           7       7           
  Lines         461     474   +13     
  Branches       77      77           
======================================
+ Hits          455     468   +13     
  Misses          4       4           
  Partials        2       2           
Impacted Files Coverage Δ
openapi_tester/loaders.py 95.9% <100.0%> (+0.2%) ⬆️
openapi_tester/schema_tester.py 100.0% <100.0%> (ø)

Copy link
Member

@sondrelg sondrelg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but I'd rather not pull in httpx as a dependency for this. Better do use a builtin library like urllib or requests. Otherwise we're forcing users to potentially pull in an extra dependency for no real gain.

openapi_tester/utils.py Outdated Show resolved Hide resolved
openapi_tester/loaders.py Outdated Show resolved Hide resolved
using django's URLValidator

using requests instead of httpx
@sondrelg
Copy link
Member

sondrelg commented Nov 5, 2022

Looks great @maticardenas 👏

@sondrelg sondrelg merged commit 1929ad3 into snok:master Nov 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants