tools/importer-rest-api-specs
- correctly find all referenced models to mixin
#4411
+101
−30
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.
resolve issue in PR #4374
supersede #4386
This PR optimize the
findAndMergeLocalMixins
to find all specific models being referenced.Current status:
findAndMergeLocalMixins
will mixin the whole swagger doc that being referenced in current file. Mixin the whole swagger file and then perform theanalysis.Flatten
will sometimes introduce un-relative models, as mentioned in #4374 (comment).More detail: networkManagerSecurityAdminConfiguration.json refer to the neworkManager.json,
findAndMergeLocalMixins
will mixin the whole neworkManager.json. And later theanalysis.Flatten
will introduce network.json#ProvisioingStateThe conflict will happen for networkManagerSecurityAdminConfiguration.json#ProvisioingState and network.json#ProvisioingState. But actually networkManagerSecurityAdminConfiguration.json only use the ProvisioingState in its own file, but another ProvisioningState is introduced while parsing networkManagerSecurityAdminConfiguration.json, through the route
networkManagerSecurityAdminConfiguration.json
-> wholenetworkManager.json
-> network.json#ProvisioningStateNote although
networkManagerSecurityAdminConfiguration.json
->network.json
, the wholenetwork.json
file will be added byfindAndMergeLocalMixins
, theProvisioningState
will not be overwritten. So the conflict is happend by the effect of bothfindAndMergeLocalMixins
andanalysis.Flatten
pandora/tools/importer-rest-api-specs/components/parser/flattener.go
Lines 55 to 72 in 49c3c7a