diff --git a/packages/entities/entities-plugins/src/components/PluginForm.cy.ts b/packages/entities/entities-plugins/src/components/PluginForm.cy.ts
index 172aa7b49e..34cadbb02f 100644
--- a/packages/entities/entities-plugins/src/components/PluginForm.cy.ts
+++ b/packages/entities/entities-plugins/src/components/PluginForm.cy.ts
@@ -23,7 +23,7 @@ const baseConfigKonnect: KonnectPluginFormConfig = {
cancelRoute: { name: 'home' },
}
-const baseConfigKM:KongManagerPluginFormConfig = {
+const baseConfigKM: KongManagerPluginFormConfig = {
app: 'kongManager',
workspace: 'default',
apiBaseUrl: '/kong-manager',
@@ -78,25 +78,6 @@ describe('', () => {
).as(params?.alias ?? 'createPlugin')
}
- const interceptKMValidatePlugin = (params?: {
- mockData?: object
- alias?: string
- status?: number
- }): void => {
- const url = `${baseConfigKM.apiBaseUrl}/${baseConfigKM.workspace}/schemas/plugins/validate`
-
- cy.intercept(
- {
- method: 'POST',
- url,
- },
- {
- statusCode: params?.status ?? 200,
- body: params?.mockData ?? plugin1,
- },
- ).as(params?.alias ?? 'validatePlugin')
- }
-
/**
* Intercepts requests for a specific scoped entity and prefetched data
* For instance, if some `service` was selected, thus we are in edit mode, this intercepts the given `entityType=service`.
@@ -574,7 +555,6 @@ describe('', () => {
it('should pick correct url while creating plugin', () => {
interceptKMSchema()
- interceptKMValidatePlugin()
interceptKMCreatePlugin()
const pluginType = 'cors'
@@ -601,7 +581,7 @@ describe('', () => {
cy.get('#tags').type('tag1,tag2')
cy.getTestId('plugin-create-form-submit').click()
- cy.wait(['@validatePlugin', '@createPlugin'])
+ cy.wait('@createPlugin')
})
it('should pick correct url while creating plugin credential', () => {
@@ -696,7 +676,6 @@ describe('', () => {
entityId: scopedService.id,
entityType: 'services',
})
- interceptKMValidatePlugin()
interceptKMOperatePlugin({
method: 'PATCH',
alias: 'updatePlugin',
@@ -731,7 +710,7 @@ describe('', () => {
cy.getTestId('plugin-edit-form-submit').click()
- cy.wait(['@validatePlugin', '@updatePlugin'])
+ cy.wait('@updatePlugin')
})
})
@@ -886,28 +865,22 @@ describe('', () => {
it('should handle error state - validation error', () => {
interceptKMSchema({ mockData: schemaMocking })
- cy.intercept(
- {
- method: 'POST',
- url: `${baseConfigKM.apiBaseUrl}/${baseConfigKM.workspace}/schemas/plugins/validate`,
- },
- {
- statusCode: 400,
- body: {
- code: 3,
- message: 'validation error',
- details: [
- {
- '@type': 'type.googleapis.com/kong.admin.model.v1.ErrorDetail',
- type: 'ERROR_TYPE_ENTITY',
- messages: [
- "at least one of these fields must be non-empty: 'config.api_specification_filename', 'config.api_specification'",
- ],
- },
- ],
- },
+ interceptKMCreatePlugin({
+ status: 400,
+ mockData: {
+ code: 3,
+ message: 'validation error',
+ details: [
+ {
+ '@type': 'type.googleapis.com/kong.admin.model.v1.ErrorDetail',
+ type: 'ERROR_TYPE_ENTITY',
+ messages: [
+ "at least one of these fields must be non-empty: 'config.api_specification_filename', 'config.api_specification'",
+ ],
+ },
+ ],
},
- ).as('validate')
+ })
const pluginType = 'mocking'
cy.mount(PluginForm, {
@@ -922,7 +895,7 @@ describe('', () => {
cy.get('.kong-ui-entities-plugin-form-container').should('be.visible')
cy.getTestId('plugin-create-form-submit').click()
- cy.wait('@validate')
+ cy.wait('@createPlugin')
cy.getTestId('form-error').should('be.visible')
})
@@ -931,7 +904,6 @@ describe('', () => {
const config = { ...baseConfigKM, entityId: scopedService.id, entityType: 'services' }
interceptKMSchema()
interceptKMOperatePlugin({ method: 'GET', alias: 'getPlugin', id: plugin1.id })
- interceptKMValidatePlugin()
interceptKMOperatePlugin({ method: 'PATCH', alias: 'updatePlugin', id: plugin1.id })
const pluginType = 'cors'
const stubbedAliases = interceptKMScopedEntity({ entityType: config.entityType }, pluginType)
@@ -963,7 +935,7 @@ describe('', () => {
cy.getTestId('plugin-edit-form-submit').click()
- cy.wait(['@validatePlugin', '@updatePlugin']).then(() => {
+ cy.wait('@updatePlugin').then(() => {
cy.get('@onUpdateSpy').should('have.been.calledOnce')
})
})
@@ -1012,25 +984,6 @@ describe('', () => {
).as(params?.alias ?? 'createPlugin')
}
- const interceptKonnectValidatePlugin = (params?: {
- mockData?: object
- alias?: string
- status?: number
- }): void => {
- const url = `${baseConfigKonnect.apiBaseUrl}/v2/control-planes/${baseConfigKonnect.controlPlaneId}/core-entities/v1/schemas/json/plugin/validate`
-
- cy.intercept(
- {
- method: 'POST',
- url,
- },
- {
- statusCode: params?.status ?? 200,
- body: params?.mockData ?? plugin1,
- },
- ).as(params?.alias ?? 'validatePlugin')
- }
-
const interceptKonnectScopedEntity = (params: {
entityType: string
mockData?: object
@@ -1492,7 +1445,6 @@ describe('', () => {
it('should pick correct url while creating plugin', () => {
interceptKonnectSchema()
- interceptKonnectValidatePlugin()
interceptKonnectCreatePlugin()
const pluginType = 'cors'
@@ -1519,7 +1471,7 @@ describe('', () => {
cy.get('#tags').type('tag1,tag2')
cy.getTestId('plugin-create-form-submit').click()
- cy.wait(['@validatePlugin', '@createPlugin'])
+ cy.wait('@createPlugin')
})
it('should pick correct url while creating plugin credential', () => {
@@ -1610,7 +1562,6 @@ describe('', () => {
entityId: scopedService.id,
entityType: 'services',
})
- interceptKonnectValidatePlugin()
interceptKonnectOperatePlugin({
method: 'PUT',
alias: 'updatePlugin',
@@ -1645,7 +1596,7 @@ describe('', () => {
cy.getTestId('plugin-edit-form-submit').click()
- cy.wait(['@validatePlugin', '@updatePlugin'])
+ cy.wait('@updatePlugin')
})
})
@@ -1799,28 +1750,22 @@ describe('', () => {
it('should handle error state - validation error', () => {
interceptKonnectSchema({ mockData: schemaMocking })
- cy.intercept(
- {
- method: 'POST',
- url: `${baseConfigKonnect.apiBaseUrl}/v2/control-planes/${baseConfigKonnect.controlPlaneId}/core-entities/v1/schemas/json/plugin/validate`,
- },
- {
- statusCode: 400,
- body: {
- code: 3,
- message: 'validation error',
- details: [
- {
- '@type': 'type.googleapis.com/kong.admin.model.v1.ErrorDetail',
- type: 'ERROR_TYPE_ENTITY',
- messages: [
- "at least one of these fields must be non-empty: 'config.api_specification_filename', 'config.api_specification'",
- ],
- },
- ],
- },
+ interceptKonnectCreatePlugin({
+ status: 400,
+ mockData: {
+ code: 3,
+ message: 'validation error',
+ details: [
+ {
+ '@type': 'type.googleapis.com/kong.admin.model.v1.ErrorDetail',
+ type: 'ERROR_TYPE_ENTITY',
+ messages: [
+ "at least one of these fields must be non-empty: 'config.api_specification_filename', 'config.api_specification'",
+ ],
+ },
+ ],
},
- ).as('validate')
+ })
const pluginType = 'mocking'
cy.mount(PluginForm, {
@@ -1835,7 +1780,7 @@ describe('', () => {
cy.get('.kong-ui-entities-plugin-form-container').should('be.visible')
cy.getTestId('plugin-create-form-submit').click()
- cy.wait('@validate')
+ cy.wait('@createPlugin')
cy.getTestId('form-error').should('be.visible')
})
@@ -1844,7 +1789,6 @@ describe('', () => {
const config = { ...baseConfigKonnect, entityId: scopedService.id, entityType: 'services' }
interceptKonnectSchema()
interceptKonnectOperatePlugin({ method: 'GET', alias: 'getPlugin', id: plugin1.id })
- interceptKonnectValidatePlugin()
interceptKonnectOperatePlugin({ method: 'PUT', alias: 'updatePlugin', id: plugin1.id })
const pluginType = 'cors'
interceptKonnectScopedEntity({ entityType: config.entityType }, pluginType)
@@ -1876,7 +1820,7 @@ describe('', () => {
cy.getTestId('plugin-edit-form-submit').click()
- cy.wait(['@validatePlugin', '@updatePlugin']).then(() => {
+ cy.wait('@updatePlugin').then(() => {
cy.get('@onUpdateSpy').should('have.been.calledOnce')
})
})
diff --git a/packages/entities/entities-plugins/src/components/PluginForm.vue b/packages/entities/entities-plugins/src/components/PluginForm.vue
index 42a4ab7e85..8196491402 100644
--- a/packages/entities/entities-plugins/src/components/PluginForm.vue
+++ b/packages/entities/entities-plugins/src/components/PluginForm.vue
@@ -1260,24 +1260,6 @@ const handleClickCancel = (): void => {
* ---------------
*/
-/**
- * Build the validate URL. Currently doesn't work for credentials.
- */
-const validateSubmitUrl = computed((): string => {
- let url = `${props.config.apiBaseUrl}${endpoints.form[props.config.app].validate}`
-
- if (props.config.app === 'konnect') {
- url = url.replace(/{controlPlaneId}/gi, props.config.controlPlaneId || '')
- } else if (props.config.app === 'kongManager') {
- url = url.replace(/\/{workspace}/gi, props.config.workspace ? `/${props.config.workspace}` : '')
- }
-
- // Always replace the id when editing
- url = url.replace(/{id}/gi, props.pluginId)
-
- return url
-})
-
/**
* Build the submit URL
*/
@@ -1371,12 +1353,6 @@ const saveFormData = async (): Promise => {
})
}
- // TODO: determine validate URL for credentials
- // don't validate custom plugins
- if (!treatAsCredential.value && !isCustomPlugin.value) {
- await axiosInstance.post(validateSubmitUrl.value, payload)
- }
-
if (formType.value === 'create') {
response = await axiosInstance.post(submitUrl.value, payload)
} else if (formType.value === 'edit') {
diff --git a/packages/entities/entities-plugins/src/plugins-endpoints.ts b/packages/entities/entities-plugins/src/plugins-endpoints.ts
index 60746f6a58..9c02050ab3 100644
--- a/packages/entities/entities-plugins/src/plugins-endpoints.ts
+++ b/packages/entities/entities-plugins/src/plugins-endpoints.ts
@@ -40,7 +40,6 @@ export default {
edit: `${konnectBaseApiUrl}/{resourceEndpoint}/{id}`,
},
credentialSchema: '/v2/control-planes/{controlPlaneId}/schemas/core-entities/{plugin}',
- validate: `${konnectBaseApiUrl}/v1/schemas/json/plugin/validate`,
// VFG endpoints24
entityGetOne: `${konnectBaseApiUrl}/{entity}/{id}`,
entityGetAll: `${konnectBaseApiUrl}/{entity}`,
@@ -61,7 +60,6 @@ export default {
edit: `${KMBaseApiUrl}/{resourceEndpoint}/{id}`,
},
credentialSchema: `${KMBaseApiUrl}/schemas/{plugin}`,
- validate: `${KMBaseApiUrl}/schemas/plugins/validate`,
// VFG endpoints
entityGetOne: `${KMBaseApiUrl}/{entity}/{id}`,
entityGetAll: `${KMBaseApiUrl}/{entity}`,
diff --git a/packages/entities/entities-upstreams-targets/src/components/TargetForm.vue b/packages/entities/entities-upstreams-targets/src/components/TargetForm.vue
index e70a6b3b58..c6dfa82d28 100644
--- a/packages/entities/entities-upstreams-targets/src/components/TargetForm.vue
+++ b/packages/entities/entities-upstreams-targets/src/components/TargetForm.vue
@@ -236,23 +236,6 @@ const onCancel = (): void => {
* ---------------
*/
-/**
- * Build the validate and submit URL
- */
-
-const validateSubmitUrl = computed((): string => {
- let url = `${props.config.apiBaseUrl}${endpoints.form[props.config.app].validate}`
-
- if (props.config.app === 'konnect') {
- url = url.replace(/{controlPlaneId}/gi, props.config?.controlPlaneId || '')
- } else if (props.config.app === 'kongManager') {
- url = url.replace(/\/{workspace}/gi, props.config?.workspace ? `/${props.config.workspace}` : '')
- }
- // Always replace the id when editing
- url = url.replace(/{id}/gi, props.targetId)
- return url
-})
-
/**
* Build the submit URL
*/
@@ -288,8 +271,6 @@ const saveFormData = async (): Promise => {
let response: AxiosResponse | undefined
- await axiosInstance.post(validateSubmitUrl.value, requestBody.value)
-
if (formType.value === 'create') {
response = await axiosInstance.post(submitUrl.value, requestBody.value)
} else if (formType.value === 'edit') {
diff --git a/packages/entities/entities-upstreams-targets/src/components/UpstreamsForm.cy.ts b/packages/entities/entities-upstreams-targets/src/components/UpstreamsForm.cy.ts
index 3aeee510bf..9a218c9b57 100644
--- a/packages/entities/entities-upstreams-targets/src/components/UpstreamsForm.cy.ts
+++ b/packages/entities/entities-upstreams-targets/src/components/UpstreamsForm.cy.ts
@@ -71,18 +71,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
},
).as('getUpstream')
}
- const interceptValidate = (status = 200): void => {
- cy.intercept(
- {
- method: 'POST',
- url: `${konnectConfig.apiBaseUrl}/v2/control-planes/${konnectConfig.controlPlaneId}/core-entities/schemas/upstreams/validate`,
- },
- {
- statusCode: status,
- body: {},
- },
- ).as('validateUpstream')
- }
it('Should render correctly', () => {
interceptFetchServices()
@@ -200,7 +188,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
it('Should emit update event after Upstream was created', () => {
interceptFetchServices()
interceptFetchCertificates()
- interceptValidate()
interceptCreate()
cy.mount(UpstreamsForm, {
@@ -219,7 +206,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
cy.get('@vueWrapper').then(wrapper => wrapper.findComponent(EntityBaseForm)
.vm.$emit('submit'))
- cy.wait('@validateUpstream')
cy.wait('@createUpstream')
cy.get('@onUpdateSpy').should('have.been.calledWith', upstreamsResponse)
@@ -228,7 +214,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
it('Error should be visible when creation fails', () => {
interceptFetchServices()
interceptFetchCertificates()
- interceptValidate()
interceptCreate(400)
cy.mount(UpstreamsForm, {
@@ -247,7 +232,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
cy.get('@vueWrapper').then(wrapper => wrapper.findComponent(EntityBaseForm)
.vm.$emit('submit'))
- cy.wait('@validateUpstream')
cy.wait('@createUpstream')
cy.get('@onUpdateSpy').should('not.have.been.called')
@@ -317,7 +301,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
interceptFetchServices()
interceptFetchCertificates()
interceptGetUpstream()
- interceptValidate()
interceptUpdate()
cy.mount(UpstreamsForm, {
@@ -334,14 +317,12 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
cy.get('@vueWrapper').then(wrapper => wrapper.findComponent(EntityBaseForm)
.vm.$emit('submit'))
- cy.wait('@validateUpstream')
cy.wait('@updateUpstream')
cy.get('@onUpdateSpy').should('have.been.calledWith', upstreamsResponse)
})
it('Should set correct values for health checks when turned on', () => {
- interceptValidate()
interceptCreate()
cy.mount(UpstreamsForm, {
@@ -389,7 +370,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
interceptFetchServices()
interceptFetchCertificates()
interceptGetUpstream(200, upstreamsResponseFull)
- interceptValidate()
interceptUpdate()
cy.mount(UpstreamsForm, {
@@ -419,7 +399,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
interceptFetchServices()
interceptFetchCertificates()
interceptGetUpstream(200, upstreamsResponseFull)
- interceptValidate()
interceptUpdate()
cy.mount(UpstreamsForm, {
@@ -509,18 +488,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
},
).as('getUpstream')
}
- const interceptValidate = (status = 200): void => {
- cy.intercept(
- {
- method: 'POST',
- url: `${KMConfig.apiBaseUrl}/${KMConfig.workspace}/schemas/upstreams/validate`,
- },
- {
- statusCode: status,
- body: {},
- },
- ).as('validateUpstream')
- }
it('Should render correctly', () => {
interceptFetchServices()
@@ -641,7 +608,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
it('Should emit update event after Upstream was created', () => {
interceptFetchServices()
interceptFetchCertificates()
- interceptValidate()
interceptCreate()
cy.mount(UpstreamsForm, {
@@ -660,7 +626,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
cy.get('@vueWrapper').then(wrapper => wrapper.findComponent(EntityBaseForm)
.vm.$emit('submit'))
- cy.wait('@validateUpstream')
cy.wait('@createUpstream')
cy.get('@onUpdateSpy').should('have.been.calledWith', upstreamsResponse)
@@ -669,7 +634,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
it('Error should be visible when creation fails', () => {
interceptFetchServices()
interceptFetchCertificates()
- interceptValidate()
interceptCreate(400)
cy.mount(UpstreamsForm, {
@@ -688,7 +652,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
cy.get('@vueWrapper').then(wrapper => wrapper.findComponent(EntityBaseForm)
.vm.$emit('submit'))
- cy.wait('@validateUpstream')
cy.wait('@createUpstream')
cy.get('@onUpdateSpy').should('not.have.been.called')
@@ -758,7 +721,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
interceptFetchServices()
interceptFetchCertificates()
interceptGetUpstream()
- interceptValidate()
interceptUpdate()
cy.mount(UpstreamsForm, {
@@ -775,7 +737,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
cy.get('@vueWrapper').then(wrapper => wrapper.findComponent(EntityBaseForm)
.vm.$emit('submit'))
- cy.wait('@validateUpstream')
cy.wait('@updateUpstream')
cy.get('@onUpdateSpy').should('have.been.calledWith', upstreamsResponse)
@@ -785,7 +746,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
interceptFetchServices()
interceptFetchCertificates()
interceptGetUpstream(200, upstreamsKMResponseFull)
- interceptValidate()
interceptUpdate(200, upstreamsKMResponseDisableActive)
cy.mount(UpstreamsForm, {
@@ -805,7 +765,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
cy.get('@vueWrapper').then(wrapper => wrapper.findComponent(EntityBaseForm)
.vm.$emit('submit'))
- cy.wait('@validateUpstream')
cy.wait('@updateUpstream')
cy.get('@onUpdateSpy').should('have.been.calledWithExactly', upstreamsKMResponseDisableActive)
@@ -815,7 +774,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
interceptFetchServices()
interceptFetchCertificates()
interceptGetUpstream(200, upstreamsKMResponseFull)
- interceptValidate()
interceptUpdate(200, upstreamsKMResponsePassiveDisabled)
cy.mount(UpstreamsForm, {
@@ -835,14 +793,12 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
cy.get('@vueWrapper').then(wrapper => wrapper.findComponent(EntityBaseForm)
.vm.$emit('submit'))
- cy.wait('@validateUpstream')
cy.wait('@updateUpstream')
cy.get('@onUpdateSpy').should('have.been.calledWithExactly', upstreamsKMResponsePassiveDisabled)
})
it('Should set correct values for health checks when turned on', () => {
- interceptValidate()
interceptCreate()
cy.mount(UpstreamsForm, {
@@ -890,7 +846,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
interceptFetchServices()
interceptFetchCertificates()
interceptGetUpstream(200, upstreamsKMResponseFull)
- interceptValidate()
interceptUpdate()
cy.mount(UpstreamsForm, {
@@ -920,7 +875,6 @@ describe('', { viewportHeight: 700, viewportWidth: 700 }, () =>
interceptFetchServices()
interceptFetchCertificates()
interceptGetUpstream(200, upstreamsResponseFull)
- interceptValidate()
interceptUpdate()
cy.mount(UpstreamsForm, {
diff --git a/packages/entities/entities-upstreams-targets/src/components/UpstreamsForm.vue b/packages/entities/entities-upstreams-targets/src/components/UpstreamsForm.vue
index d2be23a39f..ad79338f54 100644
--- a/packages/entities/entities-upstreams-targets/src/components/UpstreamsForm.vue
+++ b/packages/entities/entities-upstreams-targets/src/components/UpstreamsForm.vue
@@ -493,8 +493,6 @@ const submitData = async (): Promise => {
try {
state.readonly = true
- await axiosInstance.post(getUrl('validate'), upstreamPayload.value)
-
let response: AxiosResponse | undefined
if (formType.value === EntityBaseFormType.Create) {
diff --git a/packages/entities/entities-upstreams-targets/src/targets-endpoints.ts b/packages/entities/entities-upstreams-targets/src/targets-endpoints.ts
index f20a338a36..fdecb7de53 100644
--- a/packages/entities/entities-upstreams-targets/src/targets-endpoints.ts
+++ b/packages/entities/entities-upstreams-targets/src/targets-endpoints.ts
@@ -10,12 +10,10 @@ export default {
konnect: {
create: `${konnectBaseApiUrl}/upstreams/{upstreamId}/targets`,
edit: `${konnectBaseApiUrl}/upstreams/{upstreamId}/targets/{id}`,
- validate: `${konnectBaseApiUrl}/v1/schemas/json/target/validate`,
},
kongManager: {
create: `${KMBaseApiUrl}/upstreams/{upstreamId}/targets`,
edit: `${KMBaseApiUrl}/upstreams/{upstreamId}/targets/{id}`,
- validate: `${KMBaseApiUrl}/schemas/targets/validate`,
},
},
}
diff --git a/packages/entities/entities-upstreams-targets/src/types/upstreams-form.ts b/packages/entities/entities-upstreams-targets/src/types/upstreams-form.ts
index 05f424fb25..88ef567cb6 100644
--- a/packages/entities/entities-upstreams-targets/src/types/upstreams-form.ts
+++ b/packages/entities/entities-upstreams-targets/src/types/upstreams-form.ts
@@ -181,4 +181,4 @@ export interface UpstreamResponse extends Omit