4.0: the module exports OAS 3.1 only
RobinTail opened this issue · comments
I'm a bit confused.
If possible, could you please clarify how to operate OAS 3.0, if the module exports DSL and the model of 3.1 only?
Should Iimport from "openapi3-ts/dist/cjs/model/openapi30"
directly or what exactly is supposed?
Maybe it should be explained in the changelog or Readme.
Line 1 in 26e1740
openapi3-ts/src/model/index.ts
Line 1 in 26e1740
Line 7 in 26e1740
CC @pjmolina ?
Hi. Sorry for the delay @RobinTail
Yes. The default export points to v. 3.1.
But when needed yo consume v 3.0 you can import from:
import * from "openapi3-ts/dist/cjs/model/openapi30";
import * from "openapi3-ts/dist/cjs/dsl/openapi-builder30";
Yes, agreed. We should add it to the Readme also.
Docs updated. Published as v. 4.0.1
.
Please it checkout @RobinTail to see if now is clearer.
Thanks!
But when needed yo consume v 3.0 you can import from:
import * from "openapi3-ts/dist/cjs/model/openapi30"; import * from "openapi3-ts/dist/cjs/dsl/openapi-builder30";
I see. Unfortunately, this does not work quite well when using such imports for the further compilations both to CJS and ESM.
Would it be possible, to have re-export everything from the root index file under different names?
Thus, I wouldn't need to specify /cjs
and /esm
explicitly.
Something like import { OpenAPIBuilder30 } from "openapi3-ts";
.
Or maybe using namespaces?
Something like namespace v30 {}
(maybe) for both model and dsl.
Yes, I think we can do it, as we can just break compatibility.
A rename for the v. 3.0 should work. Let's try it.
See @RobinTail if this works for you: #103
Thank you, @pjmolina