Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] Intro GeneratorMetadata (stability index) #2816

Merged
merged 6 commits into from
May 5, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
226 changes: 113 additions & 113 deletions docs/generators.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,127 +5,127 @@ title: Generators List

The following generators are available:

* CLIENT generators:
- [ada](generators/ada.md)
- [android](generators/android.md)
- [apex](generators/apex.md)
- [bash](generators/bash.md)
- [c](generators/c.md)
- [clojure](generators/clojure.md)
- [cpp-qt5-client](generators/cpp-qt5-client.md)
- [cpp-restsdk](generators/cpp-restsdk.md)
- [cpp-tizen](generators/cpp-tizen.md)
- [csharp](generators/csharp.md)
- [csharp-dotnet2](generators/csharp-dotnet2.md)
- [csharp-netcore](generators/csharp-netcore.md)
- [dart](generators/dart.md)
- [dart-jaguar](generators/dart-jaguar.md)
- [eiffel](generators/eiffel.md)
- [elixir](generators/elixir.md)
- [elm](generators/elm.md)
- [erlang-client](generators/erlang-client.md)
- [erlang-proper](generators/erlang-proper.md)
- [flash](generators/flash.md)
- [go](generators/go.md)
- [groovy](generators/groovy.md)
- [haskell-http-client](generators/haskell-http-client.md)
- [java](generators/java.md)
- [javascript](generators/javascript.md)
- [javascript-closure-angular](generators/javascript-closure-angular.md)
- [javascript-flowtyped](generators/javascript-flowtyped.md)
- [jaxrs-cxf-client](generators/jaxrs-cxf-client.md)
- [jmeter](generators/jmeter.md)
- [kotlin](generators/kotlin.md)
- [lua](generators/lua.md)
- [objc](generators/objc.md)
- [perl](generators/perl.md)
- [php](generators/php.md)
- [powershell](generators/powershell.md)
- [python](generators/python.md)
- [r](generators/r.md)
- [ruby](generators/ruby.md)
- [rust](generators/rust.md)
- [scala-akka](generators/scala-akka.md)
- [scala-gatling](generators/scala-gatling.md)
- [scala-httpclient-deprecated](generators/scala-httpclient-deprecated.md)
- [scalaz](generators/scalaz.md)
- [swift2-deprecated](generators/swift2-deprecated.md)
- [swift3-deprecated](generators/swift3-deprecated.md)
- [swift4](generators/swift4.md)
- [typescript-angular](generators/typescript-angular.md)
- [typescript-angularjs](generators/typescript-angularjs.md)
- [typescript-aurelia](generators/typescript-aurelia.md)
- [typescript-axios](generators/typescript-axios.md)
- [typescript-fetch](generators/typescript-fetch.md)
- [typescript-inversify](generators/typescript-inversify.md)
- [typescript-jquery](generators/typescript-jquery.md)
- [typescript-node](generators/typescript-node.md)
- [typescript-rxjs](generators/typescript-rxjs.md)
## CLIENT generators
* [ada](generators/ada)
* [android](generators/android)
* [apex](generators/apex)
* [bash](generators/bash)
* [c](generators/c)
* [clojure](generators/clojure)
* [cpp-qt5-client](generators/cpp-qt5-client)
* [cpp-restsdk](generators/cpp-restsdk)
* [cpp-tizen](generators/cpp-tizen)
* [csharp](generators/csharp)
* [csharp-dotnet2 (deprecated)](generators/csharp-dotnet2)
* [csharp-netcore](generators/csharp-netcore)
* [dart](generators/dart)
* [dart-jaguar](generators/dart-jaguar)
* [eiffel](generators/eiffel)
* [elixir](generators/elixir)
* [elm](generators/elm)
* [erlang-client](generators/erlang-client)
* [erlang-proper](generators/erlang-proper)
* [flash](generators/flash)
* [go](generators/go)
* [groovy](generators/groovy)
* [haskell-http-client](generators/haskell-http-client)
* [java](generators/java)
* [javascript](generators/javascript)
* [javascript-closure-angular](generators/javascript-closure-angular)
* [javascript-flowtyped](generators/javascript-flowtyped)
* [jaxrs-cxf-client](generators/jaxrs-cxf-client)
* [jmeter](generators/jmeter)
* [kotlin](generators/kotlin)
* [lua](generators/lua)
* [objc](generators/objc)
* [perl](generators/perl)
* [php](generators/php)
* [powershell](generators/powershell)
* [python](generators/python)
* [r](generators/r)
* [ruby](generators/ruby)
* [rust](generators/rust)
* [scala-akka](generators/scala-akka)
* [scala-gatling](generators/scala-gatling)
* [scala-httpclient-deprecated](generators/scala-httpclient-deprecated)
* [scalaz](generators/scalaz)
* [swift2-deprecated](generators/swift2-deprecated)
* [swift3-deprecated](generators/swift3-deprecated)
* [swift4](generators/swift4)
* [typescript-angular](generators/typescript-angular)
* [typescript-angularjs](generators/typescript-angularjs)
* [typescript-aurelia](generators/typescript-aurelia)
* [typescript-axios](generators/typescript-axios)
* [typescript-fetch](generators/typescript-fetch)
* [typescript-inversify](generators/typescript-inversify)
* [typescript-jquery](generators/typescript-jquery)
* [typescript-node](generators/typescript-node)
* [typescript-rxjs](generators/typescript-rxjs)


* SERVER generators:
- [ada-server](generators/ada-server.md)
- [aspnetcore](generators/aspnetcore.md)
- [cpp-pistache-server](generators/cpp-pistache-server.md)
- [cpp-qt5-qhttpengine-server](generators/cpp-qt5-qhttpengine-server.md)
- [cpp-restbed-server](generators/cpp-restbed-server.md)
- [csharp-nancyfx](generators/csharp-nancyfx.md)
- [erlang-server](generators/erlang-server.md)
- [go-gin-server](generators/go-gin-server.md)
- [go-server](generators/go-server.md)
- [graphql-nodejs-express-server](generators/graphql-nodejs-express-server.md)
- [haskell](generators/haskell.md)
- [java-inflector](generators/java-inflector.md)
- [java-msf4j](generators/java-msf4j.md)
- [java-pkmst](generators/java-pkmst.md)
- [java-play-framework](generators/java-play-framework.md)
- [java-undertow-server](generators/java-undertow-server.md)
- [java-vertx](generators/java-vertx.md)
- [jaxrs-cxf](generators/jaxrs-cxf.md)
- [jaxrs-cxf-cdi](generators/jaxrs-cxf-cdi.md)
- [jaxrs-cxf-extended](generators/jaxrs-cxf-extended.md)
- [jaxrs-jersey](generators/jaxrs-jersey.md)
- [jaxrs-resteasy](generators/jaxrs-resteasy.md)
- [jaxrs-resteasy-eap](generators/jaxrs-resteasy-eap.md)
- [jaxrs-spec](generators/jaxrs-spec.md)
- [kotlin-server](generators/kotlin-server.md)
- [kotlin-spring](generators/kotlin-spring.md)
- [nodejs-server](generators/nodejs-server.md)
- [php-laravel](generators/php-laravel.md)
- [php-lumen](generators/php-lumen.md)
- [php-silex](generators/php-silex.md)
- [php-slim](generators/php-slim.md)
- [php-symfony](generators/php-symfony.md)
- [php-ze-ph](generators/php-ze-ph.md)
- [python-aiohttp](generators/python-aiohttp.md)
- [python-blueplanet](generators/python-blueplanet.md)
- [python-flask](generators/python-flask.md)
- [ruby-on-rails](generators/ruby-on-rails.md)
- [ruby-sinatra](generators/ruby-sinatra.md)
- [rust-server](generators/rust-server.md)
- [scala-finch](generators/scala-finch.md)
- [scala-lagom-server](generators/scala-lagom-server.md)
- [scala-play-server](generators/scala-play-server.md)
- [scalatra](generators/scalatra.md)
- [spring](generators/spring.md)
## SERVER generators
* [ada-server](generators/ada-server)
* [aspnetcore](generators/aspnetcore)
* [cpp-pistache-server](generators/cpp-pistache-server)
* [cpp-qt5-qhttpengine-server](generators/cpp-qt5-qhttpengine-server)
* [cpp-restbed-server](generators/cpp-restbed-server)
* [csharp-nancyfx](generators/csharp-nancyfx)
* [erlang-server](generators/erlang-server)
* [go-gin-server](generators/go-gin-server)
* [go-server](generators/go-server)
* [graphql-nodejs-express-server](generators/graphql-nodejs-express-server)
* [haskell](generators/haskell)
* [java-inflector](generators/java-inflector)
* [java-msf4j](generators/java-msf4j)
* [java-pkmst](generators/java-pkmst)
* [java-play-framework](generators/java-play-framework)
* [java-undertow-server](generators/java-undertow-server)
* [java-vertx](generators/java-vertx)
* [jaxrs-cxf](generators/jaxrs-cxf)
* [jaxrs-cxf-cdi](generators/jaxrs-cxf-cdi)
* [jaxrs-cxf-extended](generators/jaxrs-cxf-extended)
* [jaxrs-jersey](generators/jaxrs-jersey)
* [jaxrs-resteasy](generators/jaxrs-resteasy)
* [jaxrs-resteasy-eap](generators/jaxrs-resteasy-eap)
* [jaxrs-spec](generators/jaxrs-spec)
* [kotlin-server](generators/kotlin-server)
* [kotlin-spring](generators/kotlin-spring)
* [nodejs-server](generators/nodejs-server)
* [php-laravel](generators/php-laravel)
* [php-lumen](generators/php-lumen)
* [php-silex](generators/php-silex)
* [php-slim](generators/php-slim)
* [php-symfony](generators/php-symfony)
* [php-ze-ph](generators/php-ze-ph)
* [python-aiohttp](generators/python-aiohttp)
* [python-blueplanet](generators/python-blueplanet)
* [python-flask](generators/python-flask)
* [ruby-on-rails](generators/ruby-on-rails)
* [ruby-sinatra](generators/ruby-sinatra)
* [rust-server](generators/rust-server)
* [scala-finch](generators/scala-finch)
* [scala-lagom-server](generators/scala-lagom-server)
* [scala-play-server](generators/scala-play-server)
* [scalatra](generators/scalatra)
* [spring](generators/spring)


* DOCUMENTATION generators:
- [cwiki](generators/cwiki.md)
- [dynamic-html](generators/dynamic-html.md)
- [html](generators/html.md)
- [html2](generators/html2.md)
- [openapi](generators/openapi.md)
- [openapi-yaml](generators/openapi-yaml.md)
## DOCUMENTATION generators
* [cwiki](generators/cwiki)
* [dynamic-html](generators/dynamic-html)
* [html](generators/html)
* [html2](generators/html2)
* [openapi](generators/openapi)
* [openapi-yaml](generators/openapi-yaml)


* SCHEMA generators:
- [mysql-schema](generators/mysql-schema.md)
## SCHEMA generators
* [mysql-schema](generators/mysql-schema)


* CONFIG generators:
- [apache2](generators/apache2.md)
- [graphql-schema](generators/graphql-schema.md)
## CONFIG generators
* [apache2](generators/apache2)
* [graphql-schema](generators/graphql-schema)



Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import org.openapitools.codegen.CodegenConfig;
import org.openapitools.codegen.CodegenConfigLoader;
import org.openapitools.codegen.CodegenType;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;

import java.util.Comparator;
import java.util.List;
Expand Down Expand Up @@ -70,16 +72,27 @@ private void appendForType(StringBuilder sb, CodegenType type, String typeName,
sb.append(System.lineSeparator());

list.forEach(generator -> {
GeneratorMetadata meta = generator.getGeneratorMetadata();
if (docusaurus) {
sb.append("* ");
String id = "generators/" + generator.getName();
sb.append("[").append(generator.getName()).append("](").append(id).append(")");
sb.append("[").append(generator.getName());

if (meta != null && meta.getStability() != null && meta.getStability() != Stability.STABLE) {
sb.append(" (").append(meta.getStability().value()).append(")");
}

sb.append("](").append(id).append(")");

// trailing space is important for markdown list formatting
sb.append(" ");
} else {
sb.append(" - ");
sb.append(generator.getName());

if (meta != null && meta.getStability() != null && meta.getStability() != Stability.STABLE) {
sb.append(" (").append(meta.getStability().value()).append(")");
}
}
sb.append(System.lineSeparator());
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
package org.openapitools.codegen.meta;

/**
* Represents metadata about a generator.
*/
public class GeneratorMetadata {
private Stability stability;
private String generationMessage;

private GeneratorMetadata(Builder builder) {
stability = builder.stability;
generationMessage = builder.generationMessage;
}

/**
* Creates a new builder object for {@link GeneratorMetadata}.
*
* @return A new builder instance.
*/
public static Builder newBuilder() {
return new Builder();
}

/**
* Creates a new builder object for {@link GeneratorMetadata}, accepting another instance from which to copy properties.
*
* @return A new builder instance, with values preset to those of 'copy'.
*/
public static Builder newBuilder(GeneratorMetadata copy) {
Builder builder = new Builder();
if (copy != null) {
builder.stability = copy.getStability();
builder.generationMessage = copy.getGenerationMessage();
}
return builder;
}

/**
* Returns a message which can be displayed during generation.
*
* @return A message, if defined.
*/
public String getGenerationMessage() {
return generationMessage;
}

/**
* Returns an enum describing the stability index of the generator.
*
* @return The defined stability index.
*/
public Stability getStability() {
return stability;
}

/**
* {@code GeneratorMetadata} builder static inner class.
*/
public static final class Builder {
private Stability stability;
private String generationMessage;

private Builder() {
}

/**
* Sets the {@code stability} and returns a reference to this Builder so that the methods can be chained together.
*
* @param stability the {@code stability} to set
* @return a reference to this Builder
*/
public Builder stability(Stability stability) {
this.stability = stability;
return this;
}

/**
* Sets the {@code generationMessage} and returns a reference to this Builder so that the methods can be chained together.
*
* @param generationMessage the {@code generationMessage} to set
* @return a reference to this Builder
*/
public Builder generationMessage(String generationMessage) {
this.generationMessage = generationMessage;
return this;
}

/**
* Returns a {@code GeneratorMetadata} built from the parameters previously set.
*
* @return a {@code GeneratorMetadata} built with parameters of this {@code GeneratorMetadata.Builder}
*/
public GeneratorMetadata build() {
return new GeneratorMetadata(this);
}
}
}
Loading