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

Conversation

jimschubert
Copy link
Member

@jimschubert jimschubert commented May 4, 2019

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.4.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

GeneratorMetadata offers an immutable object created via Builder pattern
which allows generators to explicitly define their stability (stable,
beta, experimental, deprecated) as well as a message to be shown during
generation.

This is a step toward:

This new structure, specifically the Stability property, allows us to
offer future enhancements such as allowing users to filter down to only
"Stable" generators via CLI, and eventually any compat table (see #503).

See project 5 for other potentially related work.


This is an addition to what was introduced for the C# 2.0 generator in #2804. I had opened #2786, not realizing that the generator hadn't been deprecated as discussed in #116. After consideration, I decided to have something typed which would explicitly define the generator as deprecated in code.

Example:

$ ./bin/csharp-dotnet2-petstore.sh
# START SCRIPT: ./bin/csharp-dotnet2-petstore.sh
[main] INFO  o.o.codegen.DefaultGenerator - OpenAPI Generator: csharp-dotnet2 (client)
[main] WARN  o.o.codegen.DefaultGenerator - Generator 'csharp-dotnet2' is considered deprecated.
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.c.l.CSharpDotNet2ClientCodegen - Per Microsoft Product Lifecycle (https://support.microsoft.com/en-us/lifecycle/search?sort=PN&alpha=.NET%20Framework&Filter=FilterNO), support for .NET Framework 2.0 ended in 2011 so there may be security issues using the auto-generated C# 2.0 source code.

GeneratorMetadata offers an immutable object created via Builder pattern
which allows generators to explicitly define their stability (stable,
beta, experimental, deprecated) as well as a message to be shown during
generation.

This is a step toward:

* Fleshing out the "Core" artifact (#845)
* Providing a place to encapsulate feature-oriented metadata (#840)
* Providing a means to communicate end of life scheduling (#116)

This new structure, specifically the Stability property, allows us to
offer future enhancements such as allowing users to filter down to only
"Stable" generators via CLI, and eventually any compat table (see #503).
@auto-labeler
Copy link

auto-labeler bot commented May 4, 2019

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@jimschubert
Copy link
Member Author

Question:

This creates some redundancy in the "list" CLI command, where some generators previously encoded the stability into the name of the generator:

    - scala-httpclient-deprecated (deprecated)
    - swift2-deprecated (deprecated)
    - swift3-deprecated (deprecated)

I think this is fine for now, since machine parsing should be done via the list --short option. It seems to me that we might want an UNMAINTAINED option to differentiate between something which is deprecated (i.e. "this will be removed at some point") versus something which is either low priority or being kept with no intention to remove. If that's not the case, we may want to consider explicitly defining end of life for the above mentioned deprecated generators.

@jimschubert
Copy link
Member Author

cc @OpenAPITools/generator-core-team
for visibility @OpenAPITools/openapi-generator-collaborators

/**
* Represents the "stability index" of a generator or feature, based on the stability indexes defined in the node.js ecosystem.
*/
public enum Stability {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: We could apply Stability to other things as well, such as the templating engine adapters.

* master:
  resize lightbow logo
  add lightbow logo
  add Lightbow as sponsor (#2822)
  [docs] Document new templating engine, adding ability to reference templates by file to comlete the example (#2773)
  [JAVA][KOTLIN] fix var Naming for all uppercase with Numbers (#2794)
  [Documentation] Add instructions to build the javascript client module (#2806)
  use mvn instead of run-in-docker (#2821)
  Better handling of form data (#2818)
  [haskell-servant] Add some missing types to the generated modules (#2675)
  Clarifies need to build project for sample output (#2819)
  [Elm] Bugfix .encode in modelTypeDiscriminator (#2807)
  Apply strict spec option to CodegenConfig instance (#2814)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants