Conversation
|
Hey, @killondark, thanks for the PR! The explicit requirement for For skooma = Skooma::RSpec[Rails.root.join("docs", "openapi.yml")]
skooma.schema.registry.add_source(
"https://raw.githubusercontent.com/username/test_yml/",
JSONSkooma::Sources::Remote.new("main"),
)
config.include skooma, type: :requestSo, I think we have everything in place for this particular case (except for some proper documentation 😅). What do you think? |
|
@skryukov, I thought differently: the basic openapi yml file remains local, but it is possible to specify some $ref links to external resources, and then read files from these sources. Please, write me your opinion about Full support for external $refs for |
skryukov
left a comment
There was a problem hiding this comment.
@killondark, I just tested the remotes, and we indeed need your fix! ❤️ Let's remove the auto-resolve part and keep only the url.open.read fix here.
Another issue is that my previous example sets sources after the schema has been read, which is too late. Here's a working example with some notes on improving the interface:
# We probably should expose this via `Skooma::RSpec.registry` or allow passing a custom registry to the `Skooma::RSpec.[]` method.
Skooma.create_registry(name: Skooma::Matchers::Wrapper::TEST_REGISTRY_NAME)
.add_source(
"https://raw.githubusercontent.com/killondark/test_yml/",
JSONSkooma::Sources::Remote.new("https://raw.githubusercontent.com/killondark/test_yml/")
)
config.include Skooma::RSpec[path_to_openapi, coverage: :strict], type: :request| path = suffix ? relative_path + suffix : relative_path | ||
| url = URI.join(base, path) | ||
| URI.parse(url).open.read | ||
| url.open.read |
Hi @skryukov.
I want to make Full support for external $refs for your
skoomagem(see this point in the Feature plans).For this I patched
json_skoomagem:In the
skoomagem I rewrited yml files for tests:skooma/examples/rails_app/docs/bar_openapi.ymlusername/test_yml/main/bar_components_item.ymlskooma/examples/rails_app/docs/bar_components_error.ymlskooma/examples/rails_app/docs/baz_openapi.ymlusername/test_yml/main/baz_components_item.ymlskooma/examples/rails_app/docs/baz_components_error.ymlGive me feedback please.