Azure / Azure/data-api-builder
[Enhancement]: Predicate operators in REST for GraphQL parity
- Lingua principale
- C#
- Stelle
- 1.5k
- Fork
- 370
- Merge medio
- 3g 22h
- PR unite (30g)
- 9
Descrizione
## Graphql currently supports:
- `in`: checks if a column's value exists in a specified set of values.
- `contains`: finds a fragment anywhere in a string
- `notContains`: excludes strings containing a fragment
- `startsWith`: matches the beginning of a string
- `endsWith`: matches the end of a string
https://github.com/Azure/data-api-builder/blob/main/src/Core/Models/GraphQLFilterParsers.cs#L655-L701
## What?
Bring REST in parity with GraphQL.
## Why?
REST is our most popular endpoint type.
## How?
Here are the SQL `WHERE` clause equivalents for each `$filter` expression:
### `$filter=Category in ('Books', 'Movies', 'Games')`
```sql
WHERE Category IN ('Books', 'Movies', 'Games')
```
### `$filter=contains(Name, 'son')`
```sql
WHERE Name LIKE '%son%'
```
### `$filter=not contains(Description,'beta')`
or
### `$filter=not(contains(Description, 'beta'))`
```sql
WHERE Description NOT LIKE '%beta%'
```
### `$filter=startsWith(Name, 'Al')`
```sql
WHERE Name LIKE 'Al%'
```
### `$filter=endsWith(Name, 'son')`
```sql
WHERE Name LIKE '%son'
```
### `$filter=contains(Name, 'son') and Category in ('Books', 'Movies')`
```sql
WHERE Name LIKE '%son%' AND Category IN ('Books', 'Movies')
```
## Support
GraphQL only supports these for SQL, we can start there with REST.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia da src/Core/Models/GraphQLFilterParsers.cs alle righe 655-701 per comprendere il comportamento esistente degli operatori, quindi traccia il percorso fino al punto in cui vengono analizzate le espressioni REST $filter. Il lavoro è completato quando i filtri REST basati su SQL supportano in, contains, not contains, startsWith ed endsWith, comprese le combinazioni mostrate; verifica gli esempi documentati rispetto alle risposte REST.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp, graphql, sql
- Ambito
- api, backend
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 58/100