You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
along with a couple of other files i.e. alloy/openapi.smithy and alloy/common.smithy, the openapi file contains the definition of @openapiExtensions but when trying to compile this code we get:
ul 30, 202410:36:16AM software.amazon.smithy.openapi.fromsmithy.mappers.RemoveUnusedComponents removalRound
INFO:Removing unused OpenAPIcomponents: [#/components/schemas/ConferenceNotFound, #/components/schemas/CreateConferenceOutput, #/components/schemas/CreateConferenceInput, #/components/schemas/DeleteConferenceInput, #/components/schemas/UpdateTalkInput, #/components/schemas/CreateTalkInput, #/components/schemas/ConferenceOrTalkNotFound, #/components/schemas/ValidationErrors, #/components/schemas/FetchConferencesOutput, #/components/schemas/CreateTalkOutput, #/components/schemas/UpdateConferenceInput, #/components/schemas/UpdateTalkOutput, #/components/schemas/DeleteTalkInput]
[info] compiling 4Scala sources to /home/aleksander/repos/ducktape-talk/http/smithy/target/scala-3.3.3/classes ...
[error] -- [E008] NotFoundError:/home/aleksander/repos/ducktape-talk/http/smithy/target/scala-3.3.3/src_managed/main/smithy4s/example/Input.scala:21:71
[error] 21| int.optional[Input]("exampleField", _.exampleField).addHints(alloy.openapi.OpenapiExtensions(Map("x-format"-> smithy4s.Document.fromString("int64")))),
[error] | ^^^^^^^^^^^^^
[error] | value openapi is not a member of alloy
[error] one error found
[error] (Compile/ compileIncremental) Compilation failed
[error] Totaltime: 9 s, completed Jul30, 2024, 10:36:24AM
sbt:httpSmithy>
This was discussed on Discord here. I'll also copy over the context and a workaround that was provided by one of the maintainers:
right okay ... so it's a bug, that's caused because :
we've not generated the openapi namespace in smithy4s-core (see https://github.com/disneystreaming/smithy4s/blob/8d943ab5db5f0d72656d85928202955bc4e8d056/build.sbt#L181-L187)
we're preventing the automatic generation of anything under some namespace list, unless specified otherwise (https://github.com/disneystreaming/smithy4s/blob/8d943ab5db5f0d72656d85928202955bc4e8d056/modules/codegen/src/smithy4s/codegen/internals/CodegenImpl.scala#L140)
Could you kindly open an issue ? In the meantime, you can mitigate by having a dedicated module that would have the smithy4s codegen plugin enabled, and set the smithy4sAllowedNamespaces setting to Set("alloy.openapi")
The text was updated successfully, but these errors were encountered:
Just to provide a reproduction of the issue, let's say we're starting with a JSON Schema definition:
...we then invoke
smithytranslate json-schema-to-smithy --input example.json ../smithy
which generates this smithy file:along with a couple of other files i.e.
alloy/openapi.smithy
andalloy/common.smithy
, the openapi file contains the definition of@openapiExtensions
but when trying to compile this code we get:This was discussed on Discord here. I'll also copy over the context and a workaround that was provided by one of the maintainers:
The text was updated successfully, but these errors were encountered: