Skip to content

Commit

Permalink
Use OpenapiView and AsyncapiView to generate composite namespaces (
Browse files Browse the repository at this point in the history
  • Loading branch information
jfallows authored Feb 5, 2025
1 parent 88c9a80 commit 952aa6f
Show file tree
Hide file tree
Showing 39 changed files with 1,373 additions and 797 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import static java.util.stream.Collectors.toMap;

import java.util.List;
import java.util.function.LongFunction;
import java.util.function.ToLongFunction;

import org.agrona.collections.Long2ObjectHashMap;
Expand All @@ -35,7 +34,6 @@ public final class AsyncapiCompositeConfig
public final List<AsyncapiCompositeRouteConfig> routes;
public final List<NamespaceConfig> namespaces;

private final LongFunction<String> resolveLabel;
private final ToLongFunction<String> resolveSchemaId;

private Long2ObjectHashMap<AsyncapiOperationView> operationsById;
Expand All @@ -56,10 +54,6 @@ public AsyncapiCompositeConfig(
this.routes = routes;
this.namespaces = namespaces;

final Long2ObjectHashMap<String> labelsBySchemaId = new Long2ObjectHashMap<>();
schemas.forEach(s -> labelsBySchemaId.put(s.schemaId, s.apiLabel));
this.resolveLabel = labelsBySchemaId::get;

final Object2LongHashMap<String> schemaIdsByLabel = new Object2LongHashMap<>(NO_SCHEMA_ID);
schemas.forEach(s -> schemaIdsByLabel.put(s.apiLabel, s.schemaId));
this.resolveSchemaId = schemaIdsByLabel::get;
Expand Down Expand Up @@ -93,12 +87,6 @@ public AsyncapiCompositeRouteConfig resolve(
.orElse(null);
}

public String resolveApiId(
long apiId)
{
return resolveLabel.apply(apiId);
}

public long resolveApiId(
String apiId)
{
Expand Down
Loading

0 comments on commit 952aa6f

Please sign in to comment.