Skip to content

Commit

Permalink
feat(types): added repositoryPathTemplate to provider's `capabiliti…
Browse files Browse the repository at this point in the history
…es` (#31)

* impl

* changelog
  • Loading branch information
mattia-fumo authored Feb 22, 2024
1 parent c1266e5 commit 9913067
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 10 deletions.
2 changes: 2 additions & 0 deletions packages/console-types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

- [IDP-86](https://makeitapp.atlassian.net/browse/IDP-86): added `repositoryPathTemplate` to provider's `capabilities`

## [0.18.1] 2024-02-06

### Fixed
Expand Down
28 changes: 19 additions & 9 deletions packages/console-types/src/types/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const providerFunctionalitiesSchema = {
},
} as const

const { CONTAINER_REGISTRY, ...OTHER_CAPABILITIES } = CAPABILITIES
const { CONTAINER_REGISTRY, GIT_PROVIDER, ...OTHER_CAPABILITIES } = CAPABILITIES
export const providerCapabilitySchema = {
oneOf: [
{
Expand Down Expand Up @@ -66,15 +66,23 @@ export const providerCapabilitySchema = {
imagePullSecretName: { type: 'string' },
},
},
{
type: 'object',
additionalProperties: false,
required: [
'name',
],
properties: {
name: { const: GIT_PROVIDER },
functionalities: providerFunctionalitiesSchema,
repositoryPathTemplate: {
type: 'string',
},
},
},
],
} as const

export const providerCapabilitiesSchema = {
type: 'array',
items: providerCapabilitySchema,
} as const


export const providerSchema = {
type: 'object',
additionalProperties: false,
Expand Down Expand Up @@ -107,7 +115,10 @@ export const providerSchema = {
required: ['url'],
},
credentials: credentialsSchema,
capabilities: providerCapabilitiesSchema,
capabilities: {
type: 'array',
items: providerCapabilitySchema,
},
visibility: {
additionalProperties: false,
type: 'object',
Expand All @@ -119,7 +130,6 @@ export const providerSchema = {
} as const

export type ProviderCapability = FromSchema<typeof providerCapabilitySchema>
export type ProviderCapabilities = FromSchema<typeof providerCapabilitiesSchema>
export type Provider = FromSchema<typeof providerSchema, {
parseIfThenElseKeywords: true
}>
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ exports[`src/types/provider.test.ts TAP providers match schema > must match snap
"name": {
"type": "string",
"enum": [
"git-provider",
"secret-manager",
"ci-cd-tool",
"orchestrator-generator"
Expand Down Expand Up @@ -311,6 +310,36 @@ exports[`src/types/provider.test.ts TAP providers match schema > must match snap
"type": "string"
}
}
},
{
"type": "object",
"additionalProperties": false,
"required": [
"name"
],
"properties": {
"name": {
"const": "git-provider"
},
"functionalities": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
}
}
}
},
"repositoryPathTemplate": {
"type": "string"
}
}
}
]
}
Expand Down

0 comments on commit 9913067

Please sign in to comment.