-
Notifications
You must be signed in to change notification settings - Fork 245
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
[VSCode] server-emitter use floating version for the peer-dependenies #5385
Comments
Option 2 makes sense to me. @markcowl |
Please include me in any conversations about package or dependency versions. I'd need to understand the broader context, but we should be able to configure things to allow mixing versions (or require matching versions) as we see fit. Things may also look different pre-1.0 and post-1.0, depending how closely we decide to follow semver. Pre-1.0, NPM makes it more difficult to allow version ranges. Our general approach so far, has been to allow broad ranges of versions at install time, so things will either just work (if no breaks) or fail at runtime. Post-1.0, we may want to offer stronger compat guarantees. So right now, I agree http-server-csharp should match http-client-csharp. But I also want to think about our longer-term and bigger-picture versioning story. |
hello @allenjzhang @markcowl The same issue will occur in openapi emitter @typespec/openapi and @typespec/openapi3, @typespec/json-schema, @typespec/protobuf |
Writing here what I said in the meeting, the http-server-csharp emitter is part of the workspace and follow the same release schedule as all other packages there. It just doesn't follow the same pinned version(0.64.x). For the csharp-client emitter they release on a separate schedule which means they need to be compatible with at least 2 set of version to not have a period where we are stuck. We decided to have this very wide floating just for convinience |
I think our emitter's version policy shouldn't be decided by whether it's developed or released along with compiler, but whether it makes sense to force our end user to always use the specific versions of these emitters and compilers together and the impact on user experience from it. The coupling between these emitters and compiler are not necessary to me which would actually cause unnecessary bad user experience and trouble considering they are naturally different concept in TypeSpec and user would have different expectation when using them. Some scenarios I can think about:
So in my opinion, the version policy of emitter should just depend on the backward compatibility our compiler can provide and whether emitter needs new support/feature from compiler so that we can provide the best user experience by avoiding unnecessary trouble of version confliction which is one of the most headache problem to end user. thanks. |
So there is 2 part to separate, now and after 1.0. Now we do not garantee 100% back compat between minor version so we do this as the only version we can garantee it will work together are teh ones with the same Now after v1, I am still not sure I agree, it is very simple right now to ensure all your dependency match the same version(on top the testing is basically impossible to verify as we have all packages there and would create a massive test matrix), typespec involve a lot of dependencies and it was a nightmare before to try to find which ones works together which will inevitable be the case sa certain emitters/libraries will need newer features. |
Yeah, I think it's fine before 1.0. But after GA, people would have higher expectation to us especially in stability and compatibility. And also they will start using our Prod in bigger and more complex scenario with longer life cycle. So simply coupling our compiler and the emitter/libs may bring more trouble in some case like I mentioned above. (Especially that the compiler is in the core position of TypeSpec, so the potential impact from changing/updating it may not be ignorable or trivial in some case tech or non-tech) For your concern of the massive test matrix, do you have more detail? Because
As for the nightmare you mentioned, I don't have much context but I can image and had similar experience in other project in the early stage when everything is evolving/changing quickly. But I think things are different now considering we are GA soon. If we still have the concern that our compiler, emitters and libraries may not work well with each other and can only guarantee their latest version to work even now, then I would have some concern and would strongly suggest that we should spend some time before GA to sort out their relationship and the compatibility we can provide for GA. As for the common pattern of ecosystem, to be honest, I think I am still new to the open source world (I mostly work on C#/Sql/Azure before). But from my experience on developing, it feels not that common to me that I have to upgrade my compiler in order to use a library no matter when I am using .Net or other languages. thanks. |
Yes, after v1 the general rule is you should be able to use the followin pattern For the testing part for best practice a library should at least test with the oldest compatible version they support(as you assume the next minor version will be back compat) there is case where you might want/meed to also test a range of version which can be manageable when you work on a single library. However we have dozen which could(if we stop requiring using the same version or above) require us to not only run the workspace test but for each package install the extra dependency and do it again. Creating a My opinion is that when we get to I think you put too much emphasis on upgrading the compiler being different from upgrading libraries(where even if that was the case this still doesn't solve anything as you just push the problem to the first layer of libraries), all of those are basically the same in the typespec world. |
Maybe I didn't express myself clearly above. I didn't mean forward compatibility. What I mean is something like |
At this point, we will have a discussion around dependencies and ensure that http-server-csharp uses the suggested pattern for emitters. |
E2E VSCode extension which will include client code generation and server code generation. E2E VSCode extension will install needed emitter packages if it is not installed before.
But now, we may meet with dependency version conflict issue.

e.g. First there is an old @typespec/http-server-csharp@0.58.0-alpha.3 was installed, and it will dependent on @typespec/compiler@0.60.0.
Then we will help to install @typespec/http-client-csharp package, and it will accept @typespec/compiler (>=0.63, <1.0.0), so when we install @typespec/http-client-csharp there will be peer-dependency conflict with @typespec/http-server-csharp@0.58.0-alpha.3.
Option 1: workaround
To resolve the issue, the workaround is that we need to upgrade all existing emitter packages (client and server emitter) to latest version. This is a workaround, and it is not good customer experience: customer may not want to upgrade all the emitters when generate a code.
Option 2:
Use the floating version in peer-dependency.
As the client code emitter use peer-dependency with a floating version as following:
typespec/packages/http-client-csharp/package.json
Line 48 in c09f252
but the server emitter does not use floating version, see
typespec/packages/http-server-csharp/package.json
Line 53 in c09f252
Can server emitter has the same floating version as client emitter? In that case, we can resolve the peer dependency conflict when there are both client emitters and server emitters?
The text was updated successfully, but these errors were encountered: