-
Notifications
You must be signed in to change notification settings - Fork 75
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
[FEATURE] Make Smithy Build/Model a first class package #192
Comments
This sounds like a reasonable feature! Breaking it up into individual project types which you can use independently would be useful, though I think it's still important to keep the existing interface so that users can choose to use the more opinionated option to get up and running quickly if they're happy with it :) Interesting though that you're experiencing an issue where the cdk construct is building before the model builds - the dependency should be set up automatically here: https://github.com/aws/aws-prototyping-sdk/blob/mainline/packages/open-api-gateway/src/project/open-api-gateway-ts-project.ts#L249-L250 - I believe NX should honour the dependency graph so long as each package is in the yarn workspace. |
Agreed on the first statement, maybe "pull out" wasn't the best terminology as not everybody wants to use Smithy code generation and would like to stick with the Open API opinionated construct. For the second one, I think this has to do with
Running The only thing I have seen is how Note: I say almost all, because the generated SDK node_modules are not hoisted and shared all the way up to root. It instead just takes the entire directory (it's node modules and all) and hoisted it to root as a single unit. Not really a bad thing, just a weird thing |
Reproducing steps (sent a link to an example repo):
|
The above error seems to be a result of an underlying limitation of projen and not the prototyping SDK. When projen runs the default task (I.e. synthesizes and download dependencies). It looks like it essentially 'cd's into the directory to perform the operations. Because the cwd is no longer the root monorepo, it doesn't know that the other package exist locally and keeps trying to go out to npm to find it. Hoisting all of my dependencies to the top (in monorepo) solves the issue. May be easier to orchestrate when Smithy code generation becomes its own package |
This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon. If you wish to exclude this issue from being marked as stale, add the "backlog" label. |
Closing this issue as it hasn't seen activity for a while. Please add a comment @mentioning a maintainer to reopen. If you wish to exclude this issue from being marked as stale, add the "backlog" label. |
This change introduces Type Safe API, which replaces Open API Gateway going forward. We rename since with Smithy support, having "Open API" as part of the name is less relevant to users. Type Safe API emphasises one of the main benefits of the package, type-safety. The fundamental difference in this new package is that code generation is now a build task, rather than coupled to project synthesis. This eliminates the need to check generated code in to version control, meaning smaller and more legible code reviews. The project is now more modular, with a cleaner separation of the model, infrastructure, clients and documentation, resulting in a more intuitive directory structure. Instead of the 6 different projen projects vended by open-api-gateway (which were specific to the model language (Smithy vs OpenAPI) and infrastructure language (TS, Java or Python), this vends a single `TypeSafeApiProject` which lets you configure the infrastructure and model language. Additionally, we expose the `TypeSafeApiModelProject` to allow for the Smithy/OpenAPI model project to be used on its own, which addresses #192. We remove the opinionated "SampleApi" generated for each language, since while this was good for enabling users to deploy a hello world API with very little code change required, it involved starting users off in a less ideal way. In Java the whole CDK project was built as a superjar and deployed as a lambda (much larger jar than you'd really want). In Python the API client was built as a layer rather than using local dependencies. In typescript we put the handlers in the api infra project and relied on `NodejsFunction`'s behaviour of looking for both `.ts` and `.js` files so it'd work as a library or the root cdk app. So instead of setting users up with a less optimal project structure which "just works" out of the box, we include quick start guides in the README for how to set up different languages in the right way. Note that the README can be further extended and broken up into separate files, but should be a good start for now. Fix #192
This change introduces Type Safe API, which replaces Open API Gateway going forward. We rename since with Smithy support, having "Open API" as part of the name is less relevant to users. Type Safe API emphasises one of the main benefits of the package, type-safety. The fundamental difference in this new package is that code generation is now a build task, rather than coupled to project synthesis. This eliminates the need to check generated code in to version control, meaning smaller and more legible code reviews. The project is now more modular, with a cleaner separation of the model, infrastructure, clients and documentation, resulting in a more intuitive directory structure. Instead of the 6 different projen projects vended by open-api-gateway (which were specific to the model language (Smithy vs OpenAPI) and infrastructure language (TS, Java or Python), this vends a single `TypeSafeApiProject` which lets you configure the infrastructure and model language. Additionally, we expose the `TypeSafeApiModelProject` to allow for the Smithy/OpenAPI model project to be used on its own, which addresses #192. We remove the opinionated "SampleApi" generated for each language, since while this was good for enabling users to deploy a hello world API with very little code change required, it involved starting users off in a less ideal way. In Java the whole CDK project was built as a superjar and deployed as a lambda (much larger jar than you'd really want). In Python the API client was built as a layer rather than using local dependencies. In typescript we put the handlers in the api infra project and relied on `NodejsFunction`'s behaviour of looking for both `.ts` and `.js` files so it'd work as a library or the root cdk app. So instead of setting users up with a less optimal project structure which "just works" out of the box, we include quick start guides in the README for how to set up different languages in the right way. Note that the README can be further extended and broken up into separate files, but should be a good start for now. Fix #192
This change introduces Type Safe API, which replaces Open API Gateway going forward. We rename since with Smithy support, having "Open API" as part of the name is less relevant to users. Type Safe API emphasises one of the main benefits of the package, type-safety. The fundamental difference in this new package is that code generation is now a build task, rather than coupled to project synthesis. This eliminates the need to check generated code in to version control, meaning smaller and more legible code reviews. The project is now more modular, with a cleaner separation of the model, infrastructure, clients and documentation, resulting in a more intuitive directory structure. Instead of the 6 different projen projects vended by open-api-gateway (which were specific to the model language (Smithy vs OpenAPI) and infrastructure language (TS, Java or Python), this vends a single `TypeSafeApiProject` which lets you configure the infrastructure and model language. Additionally, we expose the `TypeSafeApiModelProject` to allow for the Smithy/OpenAPI model project to be used on its own, which addresses #192. We remove the opinionated "SampleApi" generated for each language, since while this was good for enabling users to deploy a hello world API with very little code change required, it involved starting users off in a less ideal way. In Java the whole CDK project was built as a superjar and deployed as a lambda (much larger jar than you'd really want). In Python the API client was built as a layer rather than using local dependencies. In typescript we put the handlers in the api infra project and relied on `NodejsFunction`'s behaviour of looking for both `.ts` and `.js` files so it'd work as a library or the root cdk app. So instead of setting users up with a less optimal project structure which "just works" out of the box, we include quick start guides in the README for how to set up different languages in the right way. Note that the README can be further extended and broken up into separate files, but should be a good start for now. Fix #192
This change introduces Type Safe API, which replaces Open API Gateway going forward. We rename since with Smithy support, having "Open API" as part of the name is less relevant to users. Type Safe API emphasises one of the main benefits of the package, type-safety. The fundamental difference in this new package is that code generation is now a build task, rather than coupled to project synthesis. This eliminates the need to check generated code in to version control, meaning smaller and more legible code reviews. The project is now more modular, with a cleaner separation of the model, infrastructure, clients and documentation, resulting in a more intuitive directory structure. Instead of the 6 different projen projects vended by open-api-gateway (which were specific to the model language (Smithy vs OpenAPI) and infrastructure language (TS, Java or Python), this vends a single `TypeSafeApiProject` which lets you configure the infrastructure and model language. Additionally, we expose the `TypeSafeApiModelProject` to allow for the Smithy/OpenAPI model project to be used on its own, which addresses #192. We remove the opinionated "SampleApi" generated for each language, since while this was good for enabling users to deploy a hello world API with very little code change required, it involved starting users off in a less ideal way. In Java the whole CDK project was built as a superjar and deployed as a lambda (much larger jar than you'd really want). In Python the API client was built as a layer rather than using local dependencies. In typescript we put the handlers in the api infra project and relied on `NodejsFunction`'s behaviour of looking for both `.ts` and `.js` files so it'd work as a library or the root cdk app. So instead of setting users up with a less optimal project structure which "just works" out of the box, we include quick start guides in the README for how to set up different languages in the right way. Note that the README can be further extended and broken up into separate files, but should be a good start for now. Fix #192
This change introduces Type Safe API, which replaces Open API Gateway going forward. We rename since with Smithy support, having "Open API" as part of the name is less relevant to users. Type Safe API emphasises one of the main benefits of the package, type-safety. The fundamental difference in this new package is that code generation is now a build task, rather than coupled to project synthesis. This eliminates the need to check generated code in to version control, meaning smaller and more legible code reviews. The project is now more modular, with a cleaner separation of the model, infrastructure, clients and documentation, resulting in a more intuitive directory structure. Instead of the 6 different projen projects vended by open-api-gateway (which were specific to the model language (Smithy vs OpenAPI) and infrastructure language (TS, Java or Python), this vends a single `TypeSafeApiProject` which lets you configure the infrastructure and model language. Additionally, we expose the `TypeSafeApiModelProject` to allow for the Smithy/OpenAPI model project to be used on its own, which addresses #192. We remove the opinionated "SampleApi" generated for each language, since while this was good for enabling users to deploy a hello world API with very little code change required, it involved starting users off in a less ideal way. In Java the whole CDK project was built as a superjar and deployed as a lambda (much larger jar than you'd really want). In Python the API client was built as a layer rather than using local dependencies. In typescript we put the handlers in the api infra project and relied on `NodejsFunction`'s behaviour of looking for both `.ts` and `.js` files so it'd work as a library or the root cdk app. So instead of setting users up with a less optimal project structure which "just works" out of the box, we include quick start guides in the README for how to set up different languages in the right way. Note that the README can be further extended and broken up into separate files, but should be a good start for now. Fix #192
This change introduces Type Safe API, which replaces Open API Gateway going forward. We rename since with Smithy support, having "Open API" as part of the name is less relevant to users. Type Safe API emphasises one of the main benefits of the package, type-safety. The fundamental difference in this new package is that code generation is now a build task, rather than coupled to project synthesis. This eliminates the need to check generated code in to version control, meaning smaller and more legible code reviews. The project is now more modular, with a cleaner separation of the model, infrastructure, clients and documentation, resulting in a more intuitive directory structure. Instead of the 6 different projen projects vended by open-api-gateway (which were specific to the model language (Smithy vs OpenAPI) and infrastructure language (TS, Java or Python), this vends a single `TypeSafeApiProject` which lets you configure the infrastructure and model language. Additionally, we expose the `TypeSafeApiModelProject` to allow for the Smithy/OpenAPI model project to be used on its own, which addresses #192. We remove the opinionated "SampleApi" generated for each language, since while this was good for enabling users to deploy a hello world API with very little code change required, it involved starting users off in a less ideal way. In Java the whole CDK project was built as a superjar and deployed as a lambda (much larger jar than you'd really want). In Python the API client was built as a layer rather than using local dependencies. In typescript we put the handlers in the api infra project and relied on `NodejsFunction`'s behaviour of looking for both `.ts` and `.js` files so it'd work as a library or the root cdk app. So instead of setting users up with a less optimal project structure which "just works" out of the box, we include quick start guides in the README for how to set up different languages in the right way. Note that the README can be further extended and broken up into separate files, but should be a good start for now. Fix #192
…#344) This change introduces Type Safe API, which replaces Open API Gateway going forward. We rename since with Smithy support, having "Open API" as part of the name is less relevant to users. Type Safe API emphasises one of the main benefits of the package, type-safety. The fundamental difference in this new package is that code generation is now a build task, rather than coupled to project synthesis. This eliminates the need to check generated code in to version control, meaning smaller and more legible code reviews. The project is now more modular, with a cleaner separation of the model, infrastructure, runtime and documentation, resulting in a more intuitive directory structure. Instead of the 6 different projen projects vended by open-api-gateway (which were specific to the model language (Smithy vs OpenAPI) and infrastructure language (TS, Java or Python), this vends a single `TypeSafeApiProject` which lets you configure the infrastructure and model language. Additionally, we expose the `TypeSafeApiModelProject` to allow for the Smithy/OpenAPI model project to be used on its own, which addresses #192. We remove the opinionated "SampleApi" generated for each language, since while this was good for enabling users to deploy a hello world API with very little code change required, it involved starting users off in a less ideal way. In Java the whole CDK project was built as a superjar and deployed as a lambda (much larger jar than you'd really want). In Python the API client was built as a layer rather than using local dependencies. In typescript we put the handlers in the api infra project and relied on `NodejsFunction`'s behaviour of looking for both `.ts` and `.js` files so it'd work as a library or the root cdk app. So instead of setting users up with a less optimal project structure which "just works" out of the box, we include quick start guides in the README for how to set up different languages in the right way. Note that the README can be further extended and broken up into separate files, but should be a good start for now. Fix #192
This is now addressed by The generated spec can then be used with the Note that you may need to add a |
Describe the feature
Can we pull Smithy Build and Model out of OpenAPIGateway and make it it's own project?
Use Case
Ive been using SmithyAPIGatewayTSProject to generate typescript API. Instead of generating code from an OpenAPI spec, I wanted to generate code from Smithy directly instead. The current solution has been:
I keep running into a chicken and egg problem:
nx tries to find and build all subdirectories with a package.json. So what ends up happening is that the CDK construct tries to build before the model builds. You can get around this with some projen-fu by generated SDKs, manually running
yarn install
to install the net new dependencies the SDK needs, commenting out files, adding dependencies, uncommenting files, etc, etc etc.It would be easier if the flow was:
This way, all packages can depend on model, that way, whenever I run
npx nx run-many --target build --all
.nx
will know to always build model first.Proposed Solution
No response
Other Information
No response
Acknowledgements
PDK version used
0.12.4
What languages will this feature affect?
No response
Environment details (OS name and version, etc.)
MacOS
The text was updated successfully, but these errors were encountered: