Skip POST for nodes without container/list child
[netconf.git] / restconf / restconf-openapi / src / main / java / org / opendaylight / restconf / openapi / impl / BaseYangOpenApiGeneratorRFC8040.java
1 /*
2  * Copyright (c) 2018 Inocybe Technologies and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.restconf.openapi.impl;
9
10 import static java.util.Objects.requireNonNull;
11
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
14
15 /**
16  * Base class for an RFC 8040 implementation.
17  *
18  * @author Thomas Pantelis
19  */
20 public abstract class BaseYangOpenApiGeneratorRFC8040 extends BaseYangOpenApiGenerator {
21     private final String basePath;
22
23     protected BaseYangOpenApiGeneratorRFC8040(final @NonNull DOMSchemaService schemaService) {
24         this(schemaService, "rests");
25     }
26
27     protected BaseYangOpenApiGeneratorRFC8040(final @NonNull DOMSchemaService schemaService,
28             final @NonNull String basePath) {
29         super(schemaService);
30         this.basePath = requireNonNull(basePath);
31     }
32
33     @Override
34     public String getResourcePath(final String resourceType, final String context) {
35         if ("data".equals(resourceType)) {
36             return "/" + basePath + "/data" + context;
37         }
38         return "/" + basePath + "/operations" + context;
39     }
40 }