Skip to content

Commit

Permalink
chore(Form): Remove Dataformat editor
Browse files Browse the repository at this point in the history
  • Loading branch information
lordrip committed Jan 8, 2025
1 parent cc6e1af commit d231747
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 561 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
*/
public class CamelYamlDslSchemaProcessor {
private static final String PROCESSOR_DEFINITION = "org.apache.camel.model.ProcessorDefinition";
private static final String TOKENIZER_DEFINITION = "org.apache.camel.model.TokenizerDefinition";
private static final String ROUTE_CONFIGURATION_DEFINITION = "org.apache.camel.model.RouteConfigurationDefinition";
private static final String REST_DEFINITION = "org.apache.camel.model.rest.RestDefinition";
private static final String LOAD_BALANCE_DEFINITION = "org.apache.camel.model.LoadBalanceDefinition";
Expand All @@ -44,6 +43,10 @@ public class CamelYamlDslSchemaProcessor {
private final ObjectMapper jsonMapper;
private final ObjectNode yamlDslSchema;
private final List<String> processorBlocklist = List.of("org.apache.camel.model.KameletDefinition");
static final String TOKENIZER_DEFINITION = "org.apache.camel.model.TokenizerDefinition";
static final String MARSHAL_DEFINITION = "org.apache.camel.model.MarshalDefinition";
static final String UNMARSHAL_DEFINITION = "org.apache.camel.model.UnmarshalDefinition";
private static final List<String> VALIDATED_ONE_OF = List.of(TOKENIZER_DEFINITION, MARSHAL_DEFINITION, UNMARSHAL_DEFINITION);

/**
* The processor properties those should be handled separately, i.e. remove from
Expand Down Expand Up @@ -296,7 +299,7 @@ public Map<String, ObjectNode> getProcessors() throws Exception {
processor.remove("oneOf");

/* Preparation for TokenizerDefinition, this could be propagated to all EIPs in the future */
if (processorFQCN.equals(TOKENIZER_DEFINITION)) {
if (VALIDATED_ONE_OF.contains(processorFQCN)) {
removeEmptyProperties(processor);
extractSingleOneOfFromAnyOf(processor);
removeNotFromOneOf(processor);
Expand Down Expand Up @@ -436,12 +439,6 @@ private void processAndRemoveAnyOfForSubCatalogs(String name, ObjectNode definit
definition.put("$comment", "expression");
break;
}
var refParent = def.findParent("$ref");
if (refParent != null
&& refParent.get("$ref").asText().startsWith("#/definitions/org.apache.camel.model.dataformat")) {
definition.put("$comment", "dataformat");
break;
}
if (LOAD_BALANCE_DEFINITION.equals(name)) {
definition.put("$comment", "loadbalance");
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,4 +359,12 @@ void testGetLoadBalancerCatalog() throws Exception {
void testLoadBalancerEnumParameter() throws Exception {
checkEnumParameters(loadBalancerCatalog);
}

@Test
void testMarshalEip() {
var marshalProperties = processorCatalog.withObject("/marshal").withObject("/propertiesSchema");
var marshalOneOfDef = marshalProperties.withArray("/oneOf");

assertEquals(41, marshalOneOfDef.size());
}
}
3 changes: 2 additions & 1 deletion packages/ui/src/components/Form/OneOf/OneOfSchemaList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import {
TextContent,
TextVariants,
} from '@patternfly/react-core';
import { FunctionComponent, PropsWithChildren, Ref, useCallback, useEffect, useState } from 'react';
import { FunctionComponent, PropsWithChildren, Ref, useCallback, useEffect, useMemo, useState } from 'react';
import { OneOfSchemas } from '../../../utils/get-oneof-schema-list';
import { isDefined } from '../../../utils/is-defined';
import { SchemaService } from '../schema.service';
import './OneOfSchemaList.scss';
import { TypeaheadField } from '../customField/TypeaheadField';

interface OneOfComponentProps extends PropsWithChildren {
name: string;
Expand Down

This file was deleted.

210 changes: 0 additions & 210 deletions packages/ui/src/components/Form/dataFormat/DataFormatEditor.test.tsx

This file was deleted.

Loading

0 comments on commit d231747

Please sign in to comment.