[C#][Nancy] Customize interface prefix#4557
Merged
wing328 merged 1 commit intoswagger-api:masterfrom Jan 15, 2017
Merged
Conversation
Per swagger-api#4486, this allows user to specify the use of a standard or custom prefix for interfaces. For C# based languages, this follows Microsoft's Framework Design Guidelines and uses an I- prefix. However, to avoid breaking changes with existing nancyfx generated code, the default is unset. The option supports true, false, or a custom prefix.
wing328
reviewed
Jan 15, 2017
| } | ||
|
|
||
| if (additionalProperties.containsKey(CodegenConstants.INTERFACE_PREFIX)) { | ||
| String useInterfacePrefix = additionalProperties.get(CodegenConstants.INTERFACE_PREFIX).toString(); |
Contributor
There was a problem hiding this comment.
Minor suggestion: what about using Boolean.valueOf to store CodegenConstants.INTERFACE_PREFIX as boolean instead of string so as to avoid case sensitivity issue?
Contributor
Author
There was a problem hiding this comment.
@wing328 Boolean.valueOf would return true if true, and false otherwise. This would remove support for custom prefixes, as in the example in the PR description which prefixes with ZZ.
3 tasks
davidgri
pushed a commit
to davidgri/swagger-codegen
that referenced
this pull request
May 11, 2017
Per swagger-api#4486, this allows user to specify the use of a standard or custom prefix for interfaces. For C# based languages, this follows Microsoft's Framework Design Guidelines and uses an I- prefix. However, to avoid breaking changes with existing nancyfx generated code, the default is unset. The option supports true, false, or a custom prefix.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.shand./bin/security/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates)2.3.0branch for breaking (non-backward compatible) changes.Description of the PR
Per #4486, this allows user to specify the use of a standard or custom
prefix for interfaces. For C# based languages, this follows Microsoft's
Framework Design Guidelines and uses an I- prefix. However, to avoid
breaking changes with existing nancyfx generated code, the default is
unset.
The option supports true, false, or a custom prefix.
To test:
NancyFX:
NOTE: true/false don't apply here because there is no default set. This assumes NancyFX community preference is no prefix.
C# Client
Questions...
I'd rather have NancyFX default to the I prefix and allow for the generator to also support the true/false/custom in the same way as the C# generator here. If this is cool, we'll just need to remove the
setInterfacePrefix("")line (and its comment) inNancyFXServerCodegen.