Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(types): added repositoryPathTemplate to provider's capabilities #31

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading