Skip to content

Add Microsoft.Extensions.ApiDesription.Server project and package #10669

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

Merged
merged 9 commits into from
Jun 4, 2019

Conversation

dougbu
Copy link
Contributor

@dougbu dougbu commented May 30, 2019

@dougbu dougbu requested review from pranavkm, rynowak, natemcmaster and a team May 30, 2019 22:17
@dougbu
Copy link
Contributor Author

dougbu commented May 30, 2019

Also addresses #4912 because I didn't restore the GetProjectReferenceMetadata task

@dougbu
Copy link
Contributor Author

dougbu commented May 30, 2019

@natemcmaster I'd of course appreciate any input you have on the MSBuild changes

@dougbu dougbu closed this May 30, 2019
@dougbu dougbu reopened this May 30, 2019
@Eilon Eilon added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label May 30, 2019
@dougbu dougbu force-pushed the dougbu/add.server-side.8242.2 branch from 096bb75 to 1c0d301 Compare May 31, 2019 16:04
@dougbu
Copy link
Contributor Author

dougbu commented May 31, 2019

Bit more overlap with #10667 but resolution won't be too difficult

@JunTaoLuo
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

<NoPackageAnalysis>true</NoPackageAnalysis>

<!-- Included primarily to ensure dotnet-getdocument and GetDocument.Insider can be referenced. -->
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you tested this tool when only a .NET Core 3.0 SDK is installed? I didn't see anything which configures rollforward, so I would expect the dotnet get-document.dll command to fail with a "Could not find .NET Core 2.1..." error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See #10667. That adds runtimeconfig.template.json files for dotnet-getdocument and GetDocument.Insider

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I also confirmed this works fine in a 3.0-only environment with 3.0 projects

Options added to the Open API retrieval tool ('dotnet-getdocument') command line. Available options control
console output: 'no-color', 'prefix-output' and 'verbose'. All require a double-dash prefix.
-->
<OpenApiGetDocumentOptions Condition=" '$(OpenApiGetDocumentOptions)' == '' "></OpenApiGetDocumentOptions>
Copy link
Contributor

Choose a reason for hiding this comment

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

This line doesn't do anything. "If OpenApiGetDocumentOptions is empty, assign OpenApiGetDocumentOptions to empty."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! This property should be true by default

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, wait. This is here only for documentation purposes. Should be empty by default.

<!--
If 'true' (the default), enable retrieval of Open API documents. Otherwise, this feature is completely disabled.
-->
<OpenApiRetrieveDocuments Condition=" '$(OpenApiRetrieveDocuments)' == '' ">true</OpenApiRetrieveDocuments>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would I install this package and then disable it's functionality completely? Seems like it would be simpler to say "if you want to disable the feature, uninstall the package"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Users are not usually aware of this package at all. We'll be working with NSwag and SwashBuckle to ship with a dependency on it in their existing NSwag.AspNetCore and SwashBuckle.AspNetCore. Those packages have a lot of features and some users may wish to disable this particular one.

That is, we decided on opt-out for saving Open API docs after build.

@dougbu
Copy link
Contributor Author

dougbu commented May 31, 2019

@natemcmaster @JunTaoLuo builds are looking much better now 😺

</ItemGroup>

<Target Name="OpenApiGetDocuments" Returns="@(_OpenApiProjectDocuments)">
<ReadLinesFromFile File="$(_OpenApiDocumentsCache)">
Copy link
Member

Choose a reason for hiding this comment

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

Is this actually a cache? or is this just the output of generating the documents?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TL;DR

Is your question aimed at my naming (and life) choices? I don't see much consistency in how similar MSBuild properties are named and chose something that fit.

Make a suggestion if you feel strongly please.

Details

This file is many things…

It's a cache in the sense seen in lots of MSBuild code: It's a way to avoid redoing an action (calling a task, executing a too, whatever). In particular, this file avoids reopening the app whenever a client project calls OpenApiGetDocuments.

Yes, as an implementation detail, this file is one of the files written as a result of running the tool. It lists the document files.


The file is also like many used in MSBuild code in that it summarizes multiple inputs or outputs of a task or tool. For example, I could do the Inputs=$(TargetPath)Outputs=$(_OpenApiDocumentsCache) batching trick to avoid running dotnet-getdocument even if there are multiple document files.


Finally, this file is the communication mechanism between the GenerateOpenApiDocuments and OpenApiGetDocuments targets.


<Message Importance="high" Text="%0ARetrieveOpenApiDocuments:" />
<Message Importance="high" Text=" $(_Command)" />
<Exec Command="$(_Command)" />
Copy link
Member

Choose a reason for hiding this comment

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

What are the caching expectations of this? Should we be adding some things to FileWrites so they can be removed by incremental clean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have been thinking about FileWrites both here and in the client-side glue. But, every time I start making those changes, I hit the "What if the user plans to check these files in?" question. These files aren't always throw-away. But, I could probably complicate things enough to avoid that concern e.g. with conditions on $(OpenApiDocumentsDirectory) matching the default.

I'll add a note to #4923 reminding me to work through the implications and do something.

Copy link
Member

Choose a reason for hiding this comment

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

Discussed in person. Right now there is no input/output checking and this command will re-run every time you build, even if the assembly does not change.

This is tracked separately and will be improved in the next preview.

@dougbu
Copy link
Contributor Author

dougbu commented Jun 1, 2019

Fair number of comments from a fair number of people but I'm not sure whether anything is a blocking concern. @rynowak (for example), do you approve of leaving things as-is until I address the #4923 list?

dougbu added 6 commits June 2, 2019 20:00
- remove incorrect `$(IsImplementationProject)` settings and re-run .\eng\scripts\GenerateProjectList.ps1
- address PR comments
  - correct extra word in a comment that @JunTaoLuo noticed

nits:
- minor formatting changes in Microsoft.Extensions.ApiDescription.Server.props
- remove the project file's extension from the file list cache filename
- rename targets and the project capability for consistency
- left the `OpenApiGetDocuments` target alone because it's used from client projects and isn't about generation
@dougbu dougbu force-pushed the dougbu/add.server-side.8242.2 branch from 57d669c to 2de02fa Compare June 3, 2019 03:05
@dougbu
Copy link
Contributor Author

dougbu commented Jun 3, 2019

🆙📅 for smaller fixes and a rebase on 'master'. Could someone please approve?

@dougbu
Copy link
Contributor Author

dougbu commented Jun 3, 2019

Bump @rynowak or @pranavkm

@dougbu dougbu changed the base branch from master to release/3.0-preview6 June 3, 2019 18:23
@dougbu
Copy link
Contributor Author

dougbu commented Jun 3, 2019

Retargeted to preview 6 branch. PR validation begun again.

/cc @mkArtakMSFT

@dougbu
Copy link
Contributor Author

dougbu commented Jun 4, 2019

@dougbu
Copy link
Contributor Author

dougbu commented Jun 4, 2019

Just another Helix hang unrelated to anything in this PR. Merging…

@aspnet-hello
Copy link

This comment was made automatically. If there is a problem contact [email protected].

I've triaged the above build. I've created/commented on the following issue(s)
https://github.com/aspnet/AspNetCore-Internal/issues/2521

@dougbu dougbu merged commit b3ddd65 into release/3.0-preview6 Jun 4, 2019
@ghost ghost deleted the dougbu/add.server-side.8242.2 branch June 4, 2019 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants