Skip to content

Commit 7461a19

Browse files
committed
simplified interface
1 parent ea5c79e commit 7461a19

File tree

3 files changed

+16
-23
lines changed

3 files changed

+16
-23
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ openapi-generatr consumer, for example the openapi-generatr [gradle plugin][gene
66
A consumer should be able to provide access to any generatr (by the generatr name) that is found on
77
the class path.
88

9-
For example the gradle plugin will provide a gradle task for each generatr that is available
10-
via this service interface. For the [openapi-generatr-spring][generatr-spring], based on the generatr
11-
name, this will be a `generateSpring` gradle task to run the generatr and a `generatrSpring` options
12-
object to configure it.
13-
14-
9+
For example the gradle plugin will provide a gradle task for each (configured) generatr. The task
10+
will find & run the generatr by using this service interface. By using the service interface the plugin
11+
itself does not need an explicit dependency on any generatr.
12+
1513
# implementing the api
1614

1715
To make an openapi-generatr available to a consumer (e.g. the openapi-generatr-gradle plugin) it must

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group 'com.github.hauner.openapi'
9-
version '1.0.0.B1'
9+
version '1.0.0.B2'
1010

1111
sourceCompatibility = 1.8
1212

src/main/java/com/github/hauner/openapi/api/OpenApiGeneratr.java

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.github.hauner.openapi.api;
1818

19+
import java.util.Map;
20+
1921
/**
2022
* To make an openapi-generatr available to a consumer (for example the openapi-generatr-gradle plugin)
2123
* it must implement this interface and have a
@@ -26,41 +28,34 @@
2628
* A consumer should be able to provide access to any generatr that is found on the class path.
2729
*
2830
* <p>
29-
* For example the gradle plugin will provide a gradle task and options object for each generatr that
30-
* is available via this service interface. For
31-
* <a href="https://github.com/hauner/openapi-generatr-spring">openapi-generatr-spring</a> (based
32-
* on the generatr name) this will be a {@code generateSpring} task to run the generatr and a
33-
* {@code generatrSpring} options object to configure it.
31+
* For example the gradle plugin will provide a gradle task for each (configured) generatr. This task
32+
* will find & run a generatr by using this service interface. By using the service interface it does
33+
* not need an explicit dependency on a generatr.
3434
*
3535
* @author Martin Hauner
3636
*/
37-
public interface OpenApiGeneratr<T> {
37+
public interface OpenApiGeneratr {
3838

3939
/**
4040
* The identifying name of the generatr. *Should* be globally unique so a consumer of this
4141
* interface can distinguish between different generatrs.
4242
*
4343
* <p>
4444
* It is recommended to return here the last part of the full generatr name. If the generatr
45-
* jar name is {@code openapi-generatr-spring} the name should be {@code Spring}.
45+
* jar name is {@code openapi-generatr-spring} the name should be {@code spring}.
4646
* </p>
4747
*
4848
* @return the unique name of the generatr
4949
*/
5050
String getName();
5151

5252
/**
53-
* the type of the generatr options given to the run() method.
54-
*
55-
* @return options class
56-
*/
57-
Class<T> getOptionsType();
58-
59-
/**
60-
* Runs the generatr with the given options.
53+
* Runs the generatr with the given options. The options are key value pairs. Keys are of type
54+
* {@code String} and values are of any type. A property hierarchy is possible by using
55+
* {@code Map}s as value.
6156
*
6257
* @param options the generatr configuration
6358
*/
64-
void run(T options);
59+
void run(Map<String, ?> options);
6560

6661
}

0 commit comments

Comments
 (0)