dk.jyskebank.tools.enunciate.modules.openapi.paths.Endpoint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of enunciate-openapi Show documentation
Show all versions of enunciate-openapi Show documentation
Enunciate module that generates OpenAPI output
/*
* Copyright © 2017-2018 Jyske Bank
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dk.jyskebank.tools.enunciate.modules.openapi.paths;
import static dk.jyskebank.tools.enunciate.modules.openapi.yaml.YamlHelper.safeYamlString;
import java.util.ArrayList;
import java.util.List;
import com.webcohesion.enunciate.EnunciateLogger;
import com.webcohesion.enunciate.api.PathSummary;
import com.webcohesion.enunciate.api.resources.Method;
import com.webcohesion.enunciate.api.resources.Resource;
import com.webcohesion.enunciate.api.resources.ResourceApi;
import com.webcohesion.enunciate.api.resources.ResourceGroup;
import dk.jyskebank.tools.enunciate.modules.openapi.DataTypeReferenceRenderer;
import dk.jyskebank.tools.enunciate.modules.openapi.ObjectTypeRenderer;
public class Endpoint {
private ResourceGroup resourceGroup;
private PathSummary pathSummary;
private List operations = new ArrayList<>();
public Endpoint(EnunciateLogger logger, DataTypeReferenceRenderer dataTypeReferenceRenderer, ObjectTypeRenderer objectTypeRenderer, OperationIds operationIds, List resources, ResourceApi resourceApi, ResourceGroup resourceGroup, PathSummary pathSummary) {
this.resourceGroup = resourceGroup;
this.pathSummary = pathSummary;
for (Resource resource : resources) {
for (Method m : resource.getMethods()) {
operations.add(new Operation(logger, dataTypeReferenceRenderer, objectTypeRenderer, operationIds, m, resourceGroup));
}
}
}
public String getPath() {
return safeYamlString(pathSummary.getPath());
}
public String getResourceGroupTag() {
return safeYamlString(resourceGroup.getLabel());
}
public boolean getResourceGroupDeprecated() {
return resourceGroup.getDeprecated() != null;
}
public List getOperations() {
return operations;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy