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

Protocol in update lsp config #1610

Merged
merged 17 commits into from
Oct 25, 2024

Conversation

dwalend
Copy link
Contributor

@dwalend dwalend commented Oct 11, 2024

PR Checklist (not all items are relevant to all PRs)

  • Added unit-tests (for runtime code)
  • Added bootstrapped code + smoke tests (when the rendering logic is modified)
  • Added build-plugins integration tests (when reflection loading is required at codegen-time)
  • Added alloy compliance tests (when simpleRestJson protocol behaviour is expanded/updated)
  • Updated dynamic module to match generated-code behaviour
  • Added documentation
  • Updated changelog

@dwalend dwalend marked this pull request as ready for review October 13, 2024 04:21
CHANGELOG.md Outdated
@@ -14,6 +14,7 @@ Thank you!
* Fixes an issue in which union members targetting Unit would fail to compile when used as traits (see [#1600](https://github.com/disneystreaming/smithy4s/pull/1600)).
* Make the `transform` method in generated `*Gen` algebras final. This should make it possible to derive e.g. `FunctorK` instances in cats-tagless automatically (see [#1588](https://github.com/disneystreaming/smithy4s/pull/1588)).
* Fixes commons.toKebabCase() sometimes drops the first letter (see [#1603](https://github.com/disneystreaming/smithy4s/pull/1603)).
* Added com.disneystreaming.smithy4s:smithy4s-protocol dependency to mill LSP plugin (see [#1610](https://github.com/disneystreaming/smithy4s/pull/1610)).
Copy link
Member

Choose a reason for hiding this comment

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

issue: it's not just Mill, the sbt plugin also benefits from this.

it's not exactly the LSP plugin either, just the codegen plugin. How about:

Suggested change
* Added com.disneystreaming.smithy4s:smithy4s-protocol dependency to mill LSP plugin (see [#1610](https://github.com/disneystreaming/smithy4s/pull/1610)).
* Addes `com.disneystreaming.smithy4s:smithy4s-protocol dependency` to the generation of `smithy-build.json` in the `smithy4sUpdateLspConfig` tasks of the codegen plugins (see [#1610](https://github.com/disneystreaming/smithy4s/pull/1610)).

also, we'll need a new patch version - 0.18.25 is out.

Copy link
Member

Choose a reason for hiding this comment

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

unresolving because of the 0.18.25 thing, just so that we don't forget

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've pushed a merge with the latest of series/0.18

@@ -2,23 +2,43 @@ import sbt.io.IO
val subproj = project

val subproj2 = project.enablePlugins(Smithy4sCodegenPlugin)

// "com.disneystreaming.smithy4s:smithy4s-protocol:${smithy4sVersion.value}"
Copy link
Member

Choose a reason for hiding this comment

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

issue: leftover?

val root = project
.in(file("."))
.aggregate(subproj, subproj2)
.settings(
TaskKey[Unit]("checkSmithyBuild") := {
val generated = IO.readLines(file(".") / "smithy-build.json")
val expected = IO.readLines(file(".") / "expected.json")
val expected = s"""{
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: I see why you had to inline it (the smithy4sVersion variable part), but I'm not too happy about it.

What if we invented a simple templating language so that the JSON file could still be its own file, with a placeholder like

"com.disneystreaming.smithy4s:smithy4s-protocol:${SMITHY4S_VERSION}"

and then we'd do a .replace("${SMITHY4S_VERSION}", smithy4sVersion.value) upon loading that string?

also, that file wasn't deleted in the PR so it probably still exists as a leftover.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Jakub.

Copy link
Contributor Author

@dwalend dwalend Oct 17, 2024

Choose a reason for hiding this comment

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

What would you think of changing from this string-to-string comparison to a json-to-json comparison?

The string-to-string business seems really brittle - even if the json gets loaded from a string in a file the json-to-json comparison would be less brittle.

json-to-json has a lot less magic, but if string-to-string is the standard then I won't rock the boat.

Copy link
Member

Choose a reason for hiding this comment

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

I agree, we can stick to JSON comparisons on this level. If we care about formatting, we can test that in unit tests. I don't think we care about formatting much, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you like for a json library? Circe?

Copy link
Member

Choose a reason for hiding this comment

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

yeah circe is fine here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just pushed a text version... I'll scratch at it a bit today, but this PR has been open more than a week. It's time to wrap it up.

Copy link
Member

Choose a reason for hiding this comment

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

yeah 😅

modules/codegen/src/smithy4s/codegen/SmithyBuildJson.scala Outdated Show resolved Hide resolved
Co-authored-by: Jakub Kozłowski <[email protected]>
build.sbt Outdated Show resolved Hide resolved
@dwalend
Copy link
Contributor Author

dwalend commented Oct 24, 2024

I think that's everything listed in the PR. Anything else? Otherwise it's ready to merge.

Copy link
Contributor

@Baccata Baccata left a comment

Choose a reason for hiding this comment

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

@kubukoz, I'll wait for your review

@kubukoz kubukoz merged commit 07efa38 into disneystreaming:series/0.18 Oct 25, 2024
11 checks passed
@kubukoz
Copy link
Member

kubukoz commented Oct 25, 2024

thanks!

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.

3 participants