Comments (4)
The generated enum sounds ok and the ability to set an alternative at runtime.
A mix of internal and public APIs. The URLs don't change often but they do change (order of years).
I still reckon that if it's not a mandatory field in OpenAPI then your generation shouldn't fail if missing (and it's one more obstacle in the way of people trialling your product).
from speakeasy.
Hi @davidmoten thanks for issue report.
I just wanted to follow up with some questions, if that's okay?
Generally we have taken an opinionated approach that the SDKs we generate are "batteries included" and generally work out of the box with no additional configuration needed by an end-user where possible, allowing someone to grab the SDK and just start experimenting without needing to dig into documentation too deep to figure out how to correctly configure it for a first run.
But we can definitely see the merits of a "generic" SDK for a number of different companies hosting the same API.
We do have customer's that currently do this through a "subdomain" schema ie https://{some_company}.example.com
and this is supported via Templated URLs today. Would this serve your use case? This does require a default subdomain (something like api
or example
or test
to be specified in the spec as well for that "batteries included" experience but allows end-users to change the subdomain easily.
Or are the URLs you required to be passed in vastly different and couldn't be templated? Do you have an example of what an end-user would need to specify?
If the current options don't work for you we can definitely discuss internally how to support this use case (likely some sort of configuration switch to disable the validation check on servers being defined), and get back to you on the possibility of this being added to the product.
from speakeasy.
Thanks, yeah I find the idea of templated urls to be pretty useless. We don't set server entries in any of our api definitions for the additional reason that 3 non-prod urls (dev, test, uat) and (possibly) multiple prod urls (local and cloud hosting for example) can be quite different. You need to support an override of the url anyway in the client so I don't mind if some non-existent default server url (https://url.not.yet.configured) is set by the generator because I will override it at runtime. Or of course set it empty and fail at runtime because it is empty, forcing me to configure it.
Not only that but moving my api around to different hosts after first release should just be a configuration change on a client, not require a regeneration of client code.
I'm not a serious user yet of your stuff so feel free to keep this low priority, something on the backlog.
from speakeasy.
Thanks for the info!
Generally the SDKs are generated for the "production" case and so we recommend the default server to be your production server, you can then also list all the other potential servers in the OpenAPI definition and the SDKs then generate for you typed enums etc to select from (or also provide a way to set via a string) for the additional environments as an example.
With this configuration you shouldn't need regenerate the SDK unless your production server URLs (or if you define the other environments as well) are transient and change often, if that is the case then yeah I can very much see a need to have them only provided at runtime.
Which makes me curious as to your use case for the SDKs, are these for internal usage within your own services to communicate with other internal services or SDKs you plan to release to end user of a public API?
from speakeasy.
Related Issues (20)
- [SPE-3157] Support only calling an operation when there's been a change to the request input, in a multi-operation resource.
- [SPE-3069] Support state not propagating into API requests HOT 1
- [SPE-3158] Capability to generate acceptance tests automatically (terraform)
- [SPE-3160] x-speakeasy-requires-with and x-speakeasy-xor-with plan validators for terraform HOT 1
- [SPE-3165] Support Open Enums
- [SPE-3180] Convenience function`bodyAsUtf8String()` in Java for `SDKError`
- [SPE-3183] Support oneOf schemas at the root level
- [SPE-3204] Allow globals NOT to be overwridden at operation level HOT 12
- [SPE-3166] Support passing parent SDK to call its methods in Hooks
- [SPE-3247] Feature Request: Pulumi generation
- [SPE-3249] Overloaded constructor that takes only required properties HOT 1
- Support tsconfig.json customization HOT 1
- [SPE-3377] Feature: Duplicate entries in package.json HOT 1
- Speakeasy CLI install via CURL on Windows fails HOT 4
- [SPE-3285] Environment Variable support
- [SPE-3284] Capability to support custom resources and/or custom attributes within a generated resource
- [SPE-3296] Composite key import support (terraform) HOT 1
- [SPE-3152] Automatically generate `import.sh` file to include documentation instructions for adding `id` field via the `import` block in Terraform HOT 1
- [SPE-3376] Feature: Disable client side schema validation HOT 1
- [SPE-2137] oAuth Support (Unity)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from speakeasy.