Skip to content

Commit

Permalink
feat(providers): add connection_config, credentials definition (#2768)
Browse files Browse the repository at this point in the history
## Describe your changes

Fixes
https://linear.app/nango/issue/NAN-1792/connection-config-document-in-providersyaml-and-enforce-them

- Add and enforce `connection_config` definitions
This makes sure we have a JSON schema to validate and to display
connection config in the UI and backend.
The values are returned by the endpoint but not yet used in the UI. Some
things are incomplete or might be slightly incorrect, it's a daunting
task so I have fully checked and vested all of them.


- Add and enforce the `credentials` definitions for API_KEY
Same as `connection_config`, separated to clarify the expectation. 


## Tests
![Screenshot 2024-09-25 at 18 10
18](https://github.com/user-attachments/assets/730f23e0-a63b-404e-a2da-4f181c67624c)
  • Loading branch information
bodinsamuel authored Sep 26, 2024
1 parent 7171e57 commit 7c8a114
Show file tree
Hide file tree
Showing 10 changed files with 2,009 additions and 107 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ jobs:

- name: Validate YAML
run: |
cd scripts/validation/providers
npm i
node validate.js
npm ci
npx tsx scripts/validation/providers/validate.ts
28 changes: 28 additions & 0 deletions docs-v2/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,24 @@ components:
additionalProperties: false
type: object

SimplifiedJSONSchema:
type: object
additionalProperties: false
required: ["type", "title", "description"]
properties:
type:
type: string
enum: [string]
title:
type: string
description:
type: string
example:
type: string
pattern:
type: string
format:
type: string
BaseProvider:
properties:
name:
Expand Down Expand Up @@ -1813,9 +1831,19 @@ components:
items:
type: string
type: array
connection_config:
$ref: '#/components/schemas/SimplifiedJSONSchema'
credentials:
type: object
properties:
apiKey:
$ref: '#/components/schemas/SimplifiedJSONSchema'

required:
- auth_mode
- name
- display_name
- docs
additionalProperties: false
type: object
ProviderOAuth2:
Expand Down
Loading

0 comments on commit 7c8a114

Please sign in to comment.