Skip to content

feat: add catalogSchemas in Config,catalog_schema_id in Model, Application, ToolSet (URI reference to a catalog schema), catalog_properties in Model, Application, ToolSet - #1111

Open
Katerina-Charakhovich wants to merge 12 commits into
developmentfrom
feat/add-catalog-shema-config
Open

Katerina-Charakhovich wants to merge 12 commits into
developmentfrom
feat/add-catalog-shema-config

Conversation

@Katerina-Charakhovich

Copy link
Copy Markdown
Contributor

Applicable issues

Description of changes

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Katerina-Charakhovich Katerina-Charakhovich changed the title feat: add catalogSchemas in Config (map of catalog schema objects for marketplace/catalog display metadata validation)<br>- catalog_schema_id in Model, Application, ToolSet (URI reference to a catalog schema)<br>- catalog_properties in Model, Application, ToolSet (curated marketplace/catalog display metadata, validated against catalog_schema_id) feat: add catalogSchemas in Config,catalog_schema_id in Model, Application, ToolSet (URI reference to a catalog schema), catalog_properties in Model, Application, ToolSet Jul 30, 2026
@ai-dial-actions

This comment has been minimized.

try {
return uriString == null ? null : new URI(uriString);
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Invalid application applicationTypeSchemaId: " + uriString);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applicationTypeSchemaId or catalogSchemaId?

@Mapping(target = "toolSets", ignore = true)
public abstract CatalogSchemaEntity update(CatalogSchema catalogSchema, @MappingTarget CatalogSchemaEntity entity);

@Mapping(target = "createdAt", source = "createdAt")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like those mappings are redundant

try {
return uriString == null ? null : new URI(uriString);
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Invalid application applicationTypeSchemaId: " + uriString);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applicationTypeSchemaId or catalogSchemaId?

try {
return uriString == null ? null : new URI(uriString);
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Invalid application applicationTypeSchemaId: " + uriString);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applicationTypeSchemaId or catalogSchemaId?

private Long createdAt;
private Long updatedAt;

public enum TypeEnum {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is not just Type?

Collection<ExportComponentInfo> interceptors = interceptorExporter.preview(request);
Collection<ExportComponentInfo> interceptorRunners = interceptorRunnerExporter.preview(request);
Collection<ExportApplicationTypeSchemaInfo> applicationRunners = applicationTypeSchemaExporter.preview(request);
var globalSettings = globalSettingsExporter.getGlobalSettings(request);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't catalog schemas be previewed?


@Override
Set<ExportConfigComponentType> getDirectDependencies(ExportFormat exportFormat) {
return Set.of();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand catalog schema should be added into direct dependencies of model, application, toolset

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

mapper.update(catalogSchema, entity);
jpaRepository.save(entity);

log.info("Created catalog schema with id: {}", schemaId);

@KirylKurnosenka KirylKurnosenka Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that really needed, at least under info level? Related to all other logs below


@Transactional
public void create(CatalogSchema catalogSchema) {
String schemaId = catalogSchema.getSchemaId();

@KirylKurnosenka KirylKurnosenka Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't validation similar to app schema be added?


@Transactional
public String update(String id, CatalogSchema catalogSchema, String hash) {
CatalogSchemaEntity entity = jpaRepository.findById(id)

@KirylKurnosenka KirylKurnosenka Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't validation similar to app schema and hash null check be added?

.orElseThrow(() -> new EntityNotFoundException(NOT_FOUND_MESSAGE_TEMPLATE.formatted(id)));

CatalogSchema existingSchema = mapper.toDomain(entity);
String expectedHash = calculator.calculateHash(existingSchema);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if hash=ANY_HASH there is no need to calculate hash

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

.collect(Collectors.toList());
}

public Optional<CatalogSchema> tryGet(String id) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Transactional(readOnly = true) is missing

interceptorRunnerService.rollbackInterceptorRunners(revision);
globalSettingsService.rollbackGlobalSettings(revision);
adminSettingsService.rollbackAdminSettings(revision);
catalogSchemaService.rollbackCatalogSchemas(revision);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe models, apps, toolsets should respect catalog schemas during rollback (see applications -> app type schemas as example)

AGENT,
TOOLSET,
SKILL,
INTERCEPTOR

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INTERCEPTOR is listed here but is not supported, is it okay?

.build();
}

private void resolveDependencies(SelectedItemsExportRequest request) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

model, app, toolset should respect catalog schema during custom export

return Collections.emptyList();
}

private CatalogSchema fromJson(String jsonSchema) {

@KirylKurnosenka KirylKurnosenka Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it not done similar to app schemas?


var schema = schemaWithHash.model();
var coreCatalogSchema = schemaCoreMapper.mapToCoreString(schema);
boolean isSchemaValid = SchemaConformToMetaSchemaValidator.isValid(coreCatalogSchema);

@KirylKurnosenka KirylKurnosenka Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that correct validation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@Mapping(target = "updatedAt", ignore = true)
CatalogSchemaDto toDto(CoreCatalogSchema coreCatalogSchema);

@Mapping(target = "id", source = "id")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant mapping

import org.mapstruct.Mapping;

@Mapper(componentModel = "spring", uses = {InstantMapper.class})
public interface CoreCatalogSchemaMapper {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this mapper?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted

return entitySyncStateDtoMapper.toDto(syncState);
}

public void create(@Valid CatalogSchemaDto schemaDto) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those @Valid annotations won't have effect

);

CREATE TABLE catalog_schema_entity_aud (
schema_id VARCHAR(512) NOT NULL,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 512 if main table has 850?


private String title;

@Column(length = 2048)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is length limit really needed here?


@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@CatalogPropertiesConformToSchemas(message = "All deployments with catalog_schema_id should conform to their catalog schema")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There can be the case when imported deployment refers to already existing catalog schema, which is missing in imported config. See how it was done for schemas c1d1fb1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

title text,
description text,
catalog_entity_type varchar(50),
catalog_display_name varchar(512),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be also text as for app schemas?


ALTER TABLE application_entity ADD COLUMN catalog_schema_id varchar(850);
ALTER TABLE application_entity ADD COLUMN catalog_properties text;
ALTER TABLE application_entity ADD CONSTRAINT fk_application_catalog_schema FOREIGN KEY (catalog_schema_id) REFERENCES catalog_schema_entity(schema_id);

@KirylKurnosenka KirylKurnosenka Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why foreign key name is in lower case here and below whereas above is in upper case?

@ai-dial-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants