@Override
public String createBasePathFromUriInfo(final UriInfo uriInfo) {
if (uriInfo == null) {
- return RESTCONF_CONTEXT_ROOT;
+ return DEFAULT_BASE_PATH;
}
return super.createBasePathFromUriInfo(uriInfo);
}
public ApiDocGeneratorDraftO2(DOMSchemaService schemaService) {
super(Optional.of(Objects.requireNonNull(schemaService)));
}
+
+ public ApiDocGeneratorDraftO2(DOMSchemaService schemaService, String basePath) {
+ super(Optional.of(Objects.requireNonNull(schemaService)), basePath);
+ }
}
public ApiDocGeneratorRFC8040(DOMSchemaService schemaService) {
super(Optional.of(Objects.requireNonNull(schemaService)));
}
+
+ public ApiDocGeneratorRFC8040(DOMSchemaService schemaService, String basePath) {
+ super(Optional.of(Objects.requireNonNull(schemaService)), basePath);
+ }
}
* @author Thomas Pantelis
*/
public abstract class BaseYangSwaggerGeneratorDraft02 extends BaseYangSwaggerGenerator {
- protected static final String RESTCONF_CONTEXT_ROOT = "restconf";
+
+ protected static final String DEFAULT_BASE_PATH = "restconf";
+ private final String basePath;
protected BaseYangSwaggerGeneratorDraft02(Optional<DOMSchemaService> schemaService) {
super(schemaService);
+ this.basePath = DEFAULT_BASE_PATH;
+ }
+
+ protected BaseYangSwaggerGeneratorDraft02(Optional<DOMSchemaService> schemaService, String basePath) {
+ super(schemaService);
+ this.basePath = basePath;
}
@Override
public String getDataStorePath(final String dataStore, final String context) {
- return "/" + RESTCONF_CONTEXT_ROOT + "/" + dataStore + context;
+ return "/" + basePath + "/" + dataStore + context;
}
@Override
*/
public abstract class BaseYangSwaggerGeneratorRFC8040 extends BaseYangSwaggerGenerator {
- private static final String BASE_PATH = "rests";
+ private static final String DEFAULT_BASE_PATH = "rests";
+ private final String basePath;
protected BaseYangSwaggerGeneratorRFC8040(Optional<DOMSchemaService> schemaService) {
super(schemaService);
+ this.basePath = DEFAULT_BASE_PATH;
+ }
+
+ protected BaseYangSwaggerGeneratorRFC8040(Optional<DOMSchemaService> schemaService, String basePath) {
+ super(schemaService);
+ this.basePath = basePath;
}
@Override
public String getDataStorePath(final String dataStore, final String context) {
if ("config".contains(dataStore) || "operational".contains(dataStore)) {
- return "/" + BASE_PATH + "/data" + context;
+ return "/" + basePath + "/data" + context;
}
- return "/" + BASE_PATH + "/operations" + context;
+ return "/" + basePath + "/operations" + context;
}
@Override
mountPointSwagger.init();
}
+ public MountPointSwaggerGeneratorDraft02(DOMSchemaService schemaService, DOMMountPointService mountService,
+ String basePath) {
+ super(Optional.of(Objects.requireNonNull(schemaService)), basePath);
+ mountPointSwagger = new MountPointSwagger(schemaService, mountService, this);
+ mountPointSwagger.init();
+ }
+
public MountPointSwagger getMountPointSwagger() {
return mountPointSwagger;
}
mountPointSwagger.init();
}
+ public MountPointSwaggerGeneratorRFC8040(DOMSchemaService schemaService, DOMMountPointService mountService,
+ String basePath) {
+ super(Optional.of(Objects.requireNonNull(schemaService)), basePath);
+ mountPointSwagger = new MountPointSwagger(schemaService, mountService, this);
+ mountPointSwagger.init();
+ }
+
public MountPointSwagger getMountPointSwagger() {
return mountPointSwagger;
}