Skip to content

Commit 3d10015

Browse files
committed
add version api
1 parent 28c8e35 commit 3d10015

3 files changed

Lines changed: 93 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright 2023 https://github.com/openapi-processor/openapi-processor-api
3+
* PDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.openapiprocessor.api.v2;
7+
8+
import java.util.Map;
9+
10+
/**
11+
* To make an openapi-processor available to a consumer (for example the openapi-processor-gradle
12+
* plugin) it must implement this interface and have a
13+
* {@code META-INF/services/io.openapiprocessor.api.v1.OpenApiProcessor} property file in the
14+
* resources with the class name of the implementing class.
15+
*
16+
* <p>
17+
* A consumer should be able to provide access to any processor that is found on the class path.
18+
*
19+
* The gradle plugin uses the name provided by the api to configure the processor and to provide a
20+
* task to run it. This task will find and run an openapi-processor by using the
21+
* {@code OpenApiProcessor} service interface. By using an interface it does not need an explicit
22+
* dependency on a processor.
23+
*/
24+
public interface OpenApiProcessor {
25+
26+
/**
27+
* The identifying name of the openapi-processor. *Should* be globally unique so a consumer of
28+
* this interface can distinguish between different openapi-processors.
29+
*
30+
* <p>
31+
* It is recommended to return here the last part of the full openapi-processor name. If the
32+
* processor jar name is {@code openapi-processor-spring} the name should be {@code spring}.
33+
* </p>
34+
*
35+
* @return the unique name of the openapi-processor
36+
*/
37+
String getName();
38+
39+
/**
40+
* Runs the openapi-processor with the given options. The options are key value pairs. Keys are
41+
* of type {@code String} and values are of any type. A property hierarchy is possible by using
42+
* {@code Map}s as value.
43+
*
44+
* @param options the openapi-processor configuration
45+
*/
46+
void run(Map<String, ?> options);
47+
48+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2023 https://github.com/openapi-processor/openapi-processor-api
3+
* PDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.openapiprocessor.api.v2;
7+
8+
public interface OpenApiProcessorVersion {
9+
10+
/**
11+
* The version of this openapi-processor.
12+
*
13+
* @return the version of this processor
14+
*/
15+
String getVersion();
16+
17+
/**
18+
* The latest available version of this openapi-processor.
19+
*
20+
* @return the latest version of this processor
21+
*/
22+
Version getLatestVersion();
23+
24+
/**
25+
* checks if there is newer version of this processor.
26+
*
27+
* @return true if there is a newer version, else false
28+
*/
29+
30+
boolean hasNewerVersion();
31+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright 2023 https://github.com/openapi-processor/openapi-processor-api
3+
* PDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.openapiprocessor.api.v2;
7+
8+
import java.time.Instant;
9+
10+
public interface Version {
11+
String getName();
12+
Instant getPublishedAt();
13+
String getText();
14+
}

0 commit comments

Comments
 (0)