Open paul-mcculloch opened 11 years ago
Could you provide an example of what you have in mind? Curious to see your sample data and a proposed schema.
On Nov 11, 2013, at 12:15 PM, Paul McCulloch notifications@github.com wrote:
The use case I am working with is capturing database details for different database types which have different fields that can be captured.
Alpaca doesn't know how to deal with this scenario, as far as I can see. An ideal (for my use case!) solution would be to offer a select list showing the title of each of the 'oneOf' schemas.
I guess a different (harder?) challenge is to recognise which of the available schemas is matched when loading existing data.
— Reply to this email directly or view it on GitHub.
See below. Oracle & SQLServer require different connection values to be captured. I'd like a UI which prompted for SQLServer or Oracle and rendered appropriate fields for that database type.
var schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"database": {
"description": "The database that the action processor connects to",
"type": "object",
"oneOf":[
{"$ref": "#/definitions/sql-database"},
{"$ref": "#/definitions/oracle-database"}
]
}
},
"definitions":{
"sql-database":{
"title": "SQL Database Server",
"type": "object",
"properties": {
"type": {
"enum": [ "SQLServer"],
"description": "RDBMS Type"
},
"server": {"type": "string", "minLength": 1, "description": "Database server hostname"},
"instance": {"type": "string", "description": "Instance (SQL Server Only)"},
"name": {"type": "string", "description": "Name (SQL Server Only)"},
"user": {"type": "string", "minLength": 1, "description": "SQL User"},
"password": {"type": "string", "minLength": 1, "format": "password", "description": "SQL Password"}
}
},
"oracle-database":{
"title": "Oracle Database Server",
"type": "object",
"properties": {
"type": { "enum": [ "Oracle" ] },
"server": {"type": "string", "minLength": 1, "description": "TNS Instance Name"},
"user": {"type": "string", "minLength": 1, "description": "SQL User"},
"password": {"type": "string", "minLength": 1, "format": "password", "description": "SQL Password"}
}
}
}
}
var sqlDb = {
"database": {
"type": "SQLServer",
"server": "vm-tst-sql-08r2",
"instance": "",
"name": "trunk",
"user": "sa",
"password": "8791279879afgafg2323",
}
}
var oraDb = {
"database": {
"type": "Oracle",
"server": "TRUNK.LOCAL",
"user": "paul",
"password": "password",
}
}
This looks very useful and we'd want to do it along with full support for the latest JSON schema spec.
Thanks for the example. Going to take a closer look at JSON schema v4 differences
I agree that this would be useful
Hi, I am curious to know if there was any progress made on json-schema v4.
I also want to implement something with "oneOf" relation.
Thanks
+1
This is the only reason I don't use Alpaca. It must support json-schema v4 features and "oneOf", "anyOf", "noneOf" are very useful in many use cases.
+1
This is the reason why I'm quitting Alpaca.
+ 1
Any news for the "oneOf", "anyOf", "noneOf" features?
+1
+1 I'd like to have an Alpaca query builder like "http://querybuilder.js.org/demo.html" but without support for mixed types this does not seem feasible.
+1
+1
+1000
Nearly 4 years, and no resolution?
After a little googling, it seems that JSON-Editor is a schema based editor that has oneOf - https://github.com/jdorn/json-editor
+1 Can't use Alpaca without this feature
+1 I wanted to use alpaca for binary tree where each node is a form. This is a rather general use case where you need users to create logic tree. Without "oneOf" we need to render each node as individual form, then merge together all nodes, then run schema validation. jdorn/json-editor Do have this feature but is maintained.
+1
+1
+1
Any news for the "oneOf", "anyOf", "noneOf" features?
The use case I am working with is capturing database details for different database types which have different fields that can be captured.
Alpaca doesn't know how to deal with this scenario, as far as I can see. An ideal (for my use case!) solution would be to offer a select list showing the title of each of the 'oneOf' schemas.
I guess a different (harder?) challenge is to recognise which of the available schemas is matched when loading existing data.