Skip to content
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

Refactor importers to use an interface #904

Merged

Conversation

cuminandpaprika
Copy link
Contributor

This is a fairly large PR that refactors the way that importers are called and removes the mode flag from the sysl import command. All file formats are now automatically detected. A warning message will now be presented if the flag is passed in.

This PR is best reviewed commit by commit.

Changes proposed in this pull request:

  • Refactor sysl importers to use Importer interface
  • Fix the way file detection is handled to be more specific

Checklist:

  • Added related tests
  • Made corresponding changes to the documentation

@codecov
Copy link

codecov bot commented Jun 18, 2020

Codecov Report

Merging #904 into master will decrease coverage by 0.03%.
The diff coverage is 79.11%.

@@            Coverage Diff             @@
##           master     #904      +/-   ##
==========================================
- Coverage   83.35%   83.32%   -0.04%     
==========================================
  Files          73       75       +2     
  Lines       10609    10738     +129     
==========================================
+ Hits         8843     8947     +104     
- Misses       1432     1451      +19     
- Partials      334      340       +6     
Impacted Files Coverage Δ
pkg/parse/listener_impl.go 89.59% <62.50%> (+0.08%) ⬆️
pkg/importer/importer.go 63.15% <63.15%> (ø)
pkg/mod/gomod.go 73.68% <66.66%> (+1.27%) ⬆️
pkg/parse/parse.go 83.47% <69.56%> (-0.50%) ⬇️
pkg/mod/module.go 66.66% <72.72%> (+0.95%) ⬆️
pkg/importer/swagger.go 76.00% <73.33%> (-3.60%) ⬇️
pkg/pbutil/output.go 76.00% <75.00%> (-0.48%) ⬇️
pkg/importer/formats.go 77.27% <77.27%> (ø)
pkg/importer/openapi.go 90.00% <83.95%> (+0.55%) ⬆️
pkg/importer/xsd.go 91.01% <95.23%> (+0.64%) ⬆️
... and 5 more

@cuminandpaprika cuminandpaprika force-pushed the jack/importer-interface branch from 3ba0db0 to fdb830c Compare June 18, 2020 07:50
Copy link
Contributor

@ChloePlanet ChloePlanet left a comment

Choose a reason for hiding this comment

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

LGTM

GuessFileType is intended to replace all the format parsing and guessing which occurs in multiple places throughout the sysl codebase. This attempts to isolate it in a single file.
Adds an Importer interface that improves the modularity of each importer supported by Sysl
Adds a deprecation message to the format flag but keeps it there so it doesn't break existing users of sysl, giving them a chance to remove it from their files.
Keeps OpenAPI3 as a consistent way to reference openapi 3
@cuminandpaprika cuminandpaprika force-pushed the jack/importer-interface branch from fdb830c to 3fa23f9 Compare June 28, 2020 23:56
@cuminandpaprika cuminandpaprika merged commit d74cba6 into anz-bank:master Jun 29, 2020
@cuminandpaprika cuminandpaprika deleted the jack/importer-interface branch June 29, 2020 00:02
anzopensource pushed a commit that referenced this pull request Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants