Comments (4)
is it possible for you to add a discriminator
field on your union type?
"unions": {
"discriminator": "name of field you want",
"myValue": {
"types": [
]
}
}
and then try again? I'm not familiar with the dart generator so may need to contact the author of that code generator directly
from apibuilder.
is it possible for you to add a
discriminator
field on your union type?"unions": { "discriminator": "name of field you want", "myValue": { "types": [ ] } }
and then try again? I'm not familiar with the dart generator so may need to contact the author of that code generator directly
Thanks for the reply.
I have just tried and it has no effect. And "discriminator" of the union, like this:
"unions": {
"myValue": {
"discriminator": "name of field you want",
"types": [
]
}
}
from apibuilder.
Looks like the dart generator doesn't work with primitive types in union. So, as a fix, I created a wrapper object for the primitive types:
{
"unions":{
"myValue":{
"types":[
{
"type":"integerValue",
"description":"Simple integer value."
},
{
"type":"doubleValue",
"description":"Simple double value."
},
{
"type":"someCustomValue",
"description":"A custom value."
},
{
"type":"someCustomValue2",
"description":"A custom value."
}
]
},
"integerValue":{
"description":"Object containing an integer.",
"fields":[
{
"name":"value",
"type":"integer"
}
]
},
"doubleValue":{
"description":"Object containing a double.",
"fields":[
{
"name":"value",
"type":"double"
}
]
}
}
}
from apibuilder.
thanks for sharing!
from apibuilder.
Related Issues (20)
- Swagger enums are not imported when defined in an array
- Swagger import fails on circular model dependencies
- Create a tutorial for apibuilder setup (+ Update the docker files to workable apibuilder) HOT 3
- Instructions for running service on private kubernetes cluster
- Union Types: Models can belong to different union types with different discriminators HOT 1
- Imported services duplicates in invocation form
- Add schema to https://www.schemastore.org/json/ HOT 5
- API pages: Hyperlinks from models do not work with interface types
- Problem in the example file(api.json)
- Python support
- Swagger: Path definition ignored silently if no 200 response defined
- Add http4s 0.22.x support HOT 1
- Auto authorize membership in API Builder based on GitHub org
- Support OpenAPI3 HOT 4
- Swagger: path definition ignored when unit returned in 2xx response HOT 1
- Add http4s 0.23.x Generator HOT 1
- Union types don't automatically inherit Interface fields during code generation HOT 1
- Union type json readers should check discriminator HOT 1
- Will you support $refs like the OpenAPI specification? HOT 1
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 apibuilder.