Support request: How to formulate a schema containing partially exclusive or without Or?
See original GitHub issueIāve a config which is partially exclusive OR. It may be either like this
common:
- ...
variant_a:
- ...
variant_a_again:
- ...
or
common:
- ...
variant_b:
- ...
variant_b_again:
- ...
Using a schema like schema = Map({"common": Seq(...), "variant_a": Seq(...), "variant_a_again": Seq(...)}) | Map({"common": Seq(...), "variant_b": Seq(...), "variant_b_again": Seq(...)})
should work. However I get this error strictyaml.exceptions.InvalidValidatorError: You tried to Or ('|') together 2 Map validators. Try using revalidation instead.
which prevents me from using it. To me itās not clear how to do revalidation here. How do I have to use revalidation in this case?
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (10 by maintainers)
Top Results From Across the Web
Federated schema design best practices - Apollo GraphQL Docs
Best practice #2: Design schemas in a demand-oriented, abstract way ... With federation, however, a reviews service's schema can represent a true subset...
Read more >W3C XML Schema Definition Language (XSD) 1.1 Part 1
Abstract. This document specifies the XML Schema Definition Language, which offers facilities for describing the structure and constrainingĀ ...
Read more >Schema design tips - Apache Druid
Druid datasources can be ingested with or without rollup. With rollup enabled, Druid partially aggregates your data during ingestion, potentially reducingĀ ...
Read more >Online Schema Changes | CockroachDB Docs
Update table schemas without external tools or downtime. ... Your application's queries can run normally, with no effect on read/write latency. The schema...
Read more >Non-relational data and NoSQL - Azure Architecture Center
Specifically, they tend toward having no fixed schema. Also, they tend not to support transactions, or else restrict the scope of transactions, and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fkromer I think the suggestion is something like
I think I would expect the error to come from the
OrValidator
with something like:failed to find a valid schema for the value starting at...
.Example:
In my case the schema could be one of these three:
1. Currently possible solution
2. Using an
OrValidator
withMap
3. After writing the first two I realised this could also be done using a custom validator class
I started writing a custom validator here but deleted it as it become quite long to do correctly for both
validate
andto_yaml
.Summary thoughts
I still prefer option (2). I can easily imagine option (1) becoming much more complicated if
input_data_schema
could appear in more places or at multiple levels in a deeper structure. If there are problems with (2) then (3) is an acceptable fallback.Thanks @crdoconnor, it happens to us all š (btw Iām loving
strictyaml
)@fkromer Beautiful! š Unfortunately mines a little messier as the map is the key of another map:
I can workaround it by setting
input
to be aMap()
and then looping over the keys to check which key exists so I canrevalidate
with the corresponding schema but it feels overly complicated.