How to generate open api file using the cli tool
I'm looking at: https://disneystreaming.github.io/smithy4s/docs/overview/cli and trying to generate the open api from the smithy files. in a custom directory taking the structure introduced in the quick start example as the starting point.
For a service PlaygroundService with multiple operations Choice,CreateCustomer,Hello:
playground % tree -I target
.
└── src
└── main
└── smithy
├── Choice.smithy
├── CreateCustomer.smithy
├── Hello.smithy
└── PlaygroundService.smithy
└── temp
-
I tried the following from the top directory ^:
smithy4s generate \ --output ./temp/ \ --resource-output ./temp \ --discover-modelsI simply get blank files generated under
temp/META-INF. -
I tried
cding to./src/main/smithyand re-ran the above. again. nothing. -
I played around with the
-- repositoriesand-- dependenciesoptions with no luck.
What am I missing? Would be great if you could add a minimal example in the docs as well.
I think you need to pass ./src or, to be more precise, ./src/main/smithy, as the positional argument to generate. You also probably don't need --discover-models.
This would be sth like smithy4s generate ./src --output ./temp --resource-output ./temp
D'oh! that does it @kubukoz thank you. :) shall I still keep the issue open for the docs to make this clearer?
yeah, I think that's a good idea. Would you like to make that change in the docs?
I saw this and wondered: should the CLI behave as it is right now?
In other words: when given no input:
- no specs file (positional arguments here)
- no local jar files (named argument
--localJars) - no dependencies (named argument
--dependencies)
Should we return an error?
probably yes
I think we should at least log something. An error is fine as long as it's only for CLI usage, not programmatic codegen usage
I closed my PR because in the series/0.17, we have a default dependencies, so my check was always false :/ Maybe a warning we have the model in hand and we realize that it contains no shapes is enough
Is there anything else we want to do here or can the ticket be closed?