Implement initial multi api file changes.#126
Conversation
8e466a0 to
c6100f2
Compare
Codecov Report
@@ Coverage Diff @@
## main #126 +/- ##
==========================================
+ Coverage 97.09% 97.20% +0.10%
==========================================
Files 11 11
Lines 895 929 +34
==========================================
+ Hits 869 903 +34
Misses 26 26
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
|
||
| def make_docs_blueprint(spec: AsyncApiSpec, url_prefix: Path) -> Blueprint: | ||
| bp = Blueprint("asynction_docs", __name__, url_prefix=str(url_prefix)) | ||
| def make_docs_blueprint( |
There was a problem hiding this comment.
@dedoussis I'm not sure what to do about the name here. I am passing in the spec.info.title but that only works if your title only contains the correct characters. I think for the multi API it may be a situation where the use of a new Jinja template that can handle multiple specs would be better?
|
@alex-zywicki I think it would be simpler to approach this problem from another POV. As in: keep the core of asynction aligned with Flask-SocketIO, which does not have multi API capabilities, and instead of iterating through a sequence of APIs/Specs, provide a utility that bundles multiple files together into a single object. For example: def bundle_asyncapi_specs(spec_paths: Sequence[Path]) -> AsyncApiSpec:
"""Merges multiple spec files into a single AsyncApiSpec structure"""
...Users of asynction will import this method, and pass its output to the I feel this is going to make the implementation of this feature way simpler. |
@dedoussis I'm fine with that. That was my original thought, but you seemed averse to that initially when you said 'I think merging of spec files is a recipe for disaster and I'm keen to avoid it.' If that is the approach you would prefer I can test out some implementations on my end and maybe open another PR when I have something working with my application |
I suppose it's also worth noting that AFAIK SocketIO has no concept of an API in the way we are using the term. The entire API concept in question here applies to asynction and how asynction is mapping asyncapi on to SocketIO |
Right, sorry for mis-directing you. I still believe that each of the spec file(s) should be a stand-alone API. Each yaml file should be able to be deserialised into a complete EDIT: We could add an extra flag parameter(s) in the
But this validation will be opt-in def bundle_asyncapi_specs(spec_paths: Sequence[Path], validation: bool = False) -> AsyncApiSpec:
"""Merges multiple spec files into a single AsyncApiSpec structure"""
...No need to implement validation now of course, we can start with a |
First draft of multi api file support #108.
server stores list of apis.
When
server_nameis provided, checks are performed to make sure that they resolve to the same "path".Checks for namespace conflicts are performed.