Skip to content

Remove CodeGenerator metadata in default service reference experience #7491

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

Closed
dougbu opened this issue Feb 12, 2019 · 4 comments
Closed

Remove CodeGenerator metadata in default service reference experience #7491

dougbu opened this issue Feb 12, 2019 · 4 comments
Assignees
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates enhancement This issue represents an ask for new feature or an enhancement to an existing one

Comments

@dougbu
Copy link
Contributor

dougbu commented Feb 12, 2019

Aim here is to remove the current requirement to specify the CodeGenerator metadata on <Service...Reference> (soon <OpenApiReference> and <ProtobufReference>) items in a project file.

Some metadata must remain to say "give me TypeScript" (instead of project's default language) but this should be the exception and not the rule. Fortunately, the type of document is going to be explicit (again <OpenApiReference> and <ProtobufReference>) and we won't have to choose among multiple tools. Probably best to make TargetLanguage the main override we provide in this area. (@glennc agreed?)

This change will require our Open API code generation partners (NSwag, AutoRest, ...) either all implement the same target name or include a well-known property specifying their target's prefix. Either way, the last file that declares a target or updates a property wins. So, unless our partners object, let's avoid the indirection and go with a single Open API target name. (gRPC doesn't have multiple partners for the foreseeable future and should be fine with a single target for that scenario.)

@dougbu dougbu added enhancement This issue represents an ask for new feature or an enhancement to an existing one cost: S area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels Feb 12, 2019
@dougbu dougbu added this to the 3.0.0-preview4 milestone Feb 12, 2019
@dougbu
Copy link
Contributor Author

dougbu commented Feb 12, 2019

@glennc I put this in Preview4. That make sense to you?

@mkArtakMSFT the "Small" cost here doesn't mean calendar time due to the need for NSwag changes.

@glennc
Copy link
Contributor

glennc commented Apr 1, 2019

From discussion today. Generator tag isn't required by default. There will be a language property a customer can add with the values "Default", and "TypeScript" where default means whatever the extensions/language the project is for and TypeScript is TypeScript.

@dougbu dougbu modified the milestones: 3.0.0-preview5, 3.0.0-preview6 Apr 18, 2019
dougbu added a commit that referenced this issue Apr 22, 2019
- set `%(FirstForGenerator)` based on `%(CodeGenerator)` metadata

Side note, PR fixes include
- add `%(FirstForGenerator)` metadata, #4916
- add support for disabling design-time builds, #4944
- change default output directory to `obj/`, #4945 1 of 2 (remainder will come with #8242)
- provide a default `%(CodeGenerator)` value, ##7491 1 of 2 (remainder will come in next milestone)
dougbu added a commit that referenced this issue Apr 22, 2019
- #7492
  - remove document generation from client project; will be included in Web API project infrastructure (coming soon)
  - adjust eng/ProjectReferences.props to new project name
  - simplify item de-duplication in `_CreateCompileItemsForServiceFileReferences` target i.e. use `Remove` attribute
    - also handle `.tsx` files in this target
- provide `%(FirstForGenerator)` metadata, #4916
- add `$(OpenApiGenerateAtDesignTime)` property (default `true` for now), #4944
- generate code in `obj` directory by default, #4945
- provide a default `%(CodeGenerator)` value, ##7491 1 of 2 (remainder will come in next milestone)

nits:
- remove a useless `StringBuilder.Append(...)` call
- remove `%(OpenApiProjectReference.SourceProject)` metadata, duplicated `%(OriginalItemSpec)`
- be more consistent about using element syntax for item metadata
@dougbu
Copy link
Contributor Author

dougbu commented Apr 22, 2019

Partially addressed in ce8f053. Will add language metadata soon.

@dougbu
Copy link
Contributor Author

dougbu commented Jul 23, 2019

After offline discussion with @glennc, we've decided to close this issue and await custom input on the feature's overall usability

@dougbu dougbu closed this as completed Jul 23, 2019
@dougbu dougbu removed the 1 - Ready label Jul 23, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates enhancement This issue represents an ask for new feature or an enhancement to an existing one
Projects
None yet
Development

No branches or pull requests

3 participants