Skip to content

Commit

Permalink
Merge pull request #1643 from ayeshLK/master
Browse files Browse the repository at this point in the history
Fix serviceId selection logic to update the generated OAS context
  • Loading branch information
ayeshLK authored Apr 3, 2024
2 parents de5adbb + cc560b5 commit 2fd027a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

package io.ballerina.openapi.service.mapper.hateoas;

import java.util.Arrays;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -32,11 +32,9 @@ public class Service {
private final Map<String, List<Resource>> hateoasResourceMapping = new HashMap<>();

public void addResource(String resourceName, Resource resource) {
if (hateoasResourceMapping.containsKey(resourceName)) {
hateoasResourceMapping.get(resourceName).add(resource);
return;
}
hateoasResourceMapping.put(resourceName, Arrays.asList(resource));
List<Resource> resources = hateoasResourceMapping.getOrDefault(resourceName, new ArrayList<>());
resources.add(resource);
hateoasResourceMapping.put(resourceName, resources);
}

public Map<String, List<Resource>> getHateoasResourceMapping() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private void generateOpenApiDoc(Project project, OpenApiDocConfig config, Syntax
if (!embed) {
return;
}
int serviceId = config.getSemanticModel().hashCode();
int serviceId = config.getServiceSymbol().hashCode();
String targetFile = String.format(FILE_NAME_FORMAT, serviceId);
OASGenerationMetaInfo.OASGenerationMetaInfoBuilder builder = new
OASGenerationMetaInfo.OASGenerationMetaInfoBuilder();
Expand Down

0 comments on commit 2fd027a

Please sign in to comment.