2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.sal.rest.doc.impl;
10 import static org.opendaylight.netconf.sal.rest.doc.impl.ApiDocServiceImpl.OAversion;
12 import java.util.Objects;
13 import javax.ws.rs.core.UriInfo;
14 import org.opendaylight.netconf.sal.rest.doc.impl.ApiDocServiceImpl.URIType;
15 import org.opendaylight.netconf.sal.rest.doc.swagger.CommonApiObject;
16 import org.opendaylight.netconf.sal.rest.doc.swagger.SwaggerObject;
18 public class AllModulesDocGenerator {
19 private final ApiDocGeneratorDraftO2 apiDocGeneratorDraft02;
20 private final ApiDocGeneratorRFC8040 apiDocGeneratorRFC8040;
22 public AllModulesDocGenerator(final ApiDocGeneratorDraftO2 apiDocGeneratorDraft02,
23 final ApiDocGeneratorRFC8040 apiDocGeneratorRFC8040) {
24 this.apiDocGeneratorDraft02 = Objects.requireNonNull(apiDocGeneratorDraft02);
25 this.apiDocGeneratorRFC8040 = Objects.requireNonNull(apiDocGeneratorRFC8040);
28 public CommonApiObject getAllModulesDoc(final UriInfo uriInfo, final URIType uriType, final OAversion oaversion) {
29 final DefinitionNames definitionNames = new DefinitionNames();
30 final SwaggerObject doc;
31 if (uriType.equals(URIType.DRAFT02)) {
32 doc = apiDocGeneratorDraft02.getAllModulesDoc(uriInfo, definitionNames, uriType, oaversion);
34 doc = apiDocGeneratorRFC8040.getAllModulesDoc(uriInfo, definitionNames, uriType, oaversion);
37 return BaseYangSwaggerGenerator.getAppropriateDoc(doc, oaversion);