Commit Graph

4385 Commits

Author SHA1 Message Date
Doug Bunting d3c8d171bd
Fix builds that do real signing e.g. UniverseCoherence 2018-10-11 21:13:23 -07:00
Doug Bunting 18acae77c8
Merge pull request #8585 from aspnet/feature/client.code.generation
Merge feature/client.code.generation branch into release/2.2
2018-10-11 16:36:36 -07:00
Doug Bunting 8c58fdb755 Add Newtonsoft.Json.dll to Microsoft.Extensions.ApiDescription.Design package
- also remove dotnet-getdocument.runtimeconfig.dev.json file
2018-10-11 15:51:20 -07:00
Pranav K f6fc34aff9 React to CORS changes 2018-10-11 12:23:43 -07:00
Doug Bunting 5cd86977ed
Rename client code generation components
- #8523
- main project / package --> `Microsoft.Extensions.ApiDescription.Design`
- tasks assembly and namespace --> `Microsoft.Extensions.ApiDescription.Tasks`
- tool namespace --> `Microsoft.Extensions.ApiDescription.Tool`
- targets --> verbs e.g. `GenerateTypeScriptNSwag` and `GenerateDocumentDefault`
- `@(ServiceProjectReference)` metadata -> align with common MSBuild project properties
  - exception: `$(MSBuildProjectExtensionsPath)`; it's readonly and `%(ProjectExtensionsPath)` is unambiguous
    - use `%(ProjectExtensionsPath)`
  - also add `%(Targets)` metadata and remove unused `%(ProjectRuntimeIdentifier)`
- `@(<ServiceProjectReferenceMetadata)` metadata -> align with MSBuild project properties
  - exceptions: `$(MSBuildProjectDirectory)`, `$(MSBuildProjectExtensionsPath)` and `$(MSBuildProjectName)`
    - readonly properties and names already unambiguous
2018-10-10 14:52:57 -07:00
Doug Bunting d3442f3590
Create a single Microsoft.Extensions.ApiDescription.Client package
- #8428
- add signing-related and PackageVerifier configuration for new package
- remove packaging configuration from dotnet-getdocument project
- adjust `dotnet-getdocument` invocation to its new location
- remove use of nonexistent (ignored) `dotnet-getdocument --no-build` option

Remove `--uri` feature from `dotnet-getdocument`
- reduce dependencies from Microsoft.AspNetCore.TestHost to Microsoft.AspNetCore.Hosting.Abstractions
  - assume web site depends on that
- merge `DownloadFileCore` into `DownloadFile`
- remove other unecessary code e.g. `WrappedException` was never `throw`n

Correct issues in `DownloadFile`
- e.g. dispose of `responseStream`, use `await` more, support FIPS-compliant machines

nits:
- clean up `Project` and the metadata it fetches
- remove unnecessary `.props` and `.targets` files
2018-10-10 14:52:56 -07:00
Doug Bunting 5a58f81d8d
Use Internal.AspNetCore.Sdk as an MSBuild SDK in new projects
- follow-up to 5bddd226a3
2018-10-10 14:52:56 -07:00
Doug Bunting ea80199e53
Fix a few issues with Microsoft.Extensions.ApiDescription.Client targets
- follow-ups to 1646345955 and 9d109f5956
- fix `%(Command)` updates in `DefaultDocumentGenerator` target
  - later references to metadata values set within an item are not up-to-date
- qualify values for `%(SourceProject)`, `%(SourceUri)` and `%(SourceDocument)` when setting that metadata
  - MSBuild can't distinguish unqualified metadata references unless using `<X Update="@(X)">`
- fix `@(CurrentServiceFileReference)` items
  - was a copy 'n paste error in `_ServiceFileReferenceGenerator_Core` target
- remove per-language default namespace values
- do not add TypeScript files to `@(Compile)`; generally enhance final item additions
  - use `$(DefaultLanguageSourceExtension)` to help here
  - exclude generated source files with `%(OutputPath)` that does not match `$(DefaultLanguageSourceExtension)`
  - really support `%(OutputPath)` directories
- stick with current `$(TargetFramework)` when building `...ReferenceGenerator_Inner` targets
  - `%(ProjectTargetFramework)` will not exist for all `@(ServiceFileReference)` items
  - building the current project, not a service project; `%(ProjectTargetFramework)` may not be supported

nits:
- shorten a few more long lines in Microsoft.Extensions.ApiDescription.Client.targets
- reduce logging from that file
- do not include `%(SerializedMetadata)` in `%(SerializedMetadata)`
  - caused extra-long serialization of items that were originally `@(ServiceProjectReference)`s
- add more info to various comments
- always use element syntax for metadata additions
2018-10-10 14:52:55 -07:00
Doug Bunting fb9393febf
Correct metadata additions and add errors about metadata
- related to #8419 and (more generally) #7947
- add errors for missing required metadata
- add errors for duplicate `%(DocumentPath)` and `%(OutputPath)` metadata
- remove `[Required]` for task inputs that may be `null` or empty
- correct `%(DocumentPath)`s generated in `GetProjectReferenceMetadata` task
  - use this task
2018-10-10 14:52:55 -07:00
Doug Bunting 87e304334d
Remove batching requirements placed on code and document generator providers
- #8419
- perform batching and `@(ServiceFileReference)` and `@(Compile)` additions in common code
  - take advantage of new simplicity in `DefaultDocumentGenerator` target
- add metadata serialization / deserialization in support of passing items into `<MSBuild />`
  - also ensure metadata values are escaped before calling `ITaskItem.SetMetadata(...)`
- correct typos in Microsoft.Extensions.ApiDescription.Client.* e.g. in comments and metadata names
- move last remaining `GenerationTasks` file

nits:
- combine `_ServiceProjectReferenceGenerator_Restore` and `_ServiceProjectReferenceGenerator_Build` targets
  - only build web sites projects once
- remove unused `buildMultiTargeting` targets
- remove qualification of metadata listed in an `<ItemDefinitionGroup />`; will always exist
- add / remove a few `Condition`s that were missing / redundant
- move properties users won't normally set to Microsoft.Extensions.ApiDescription.Client.targets
- shorten lines in MSBuild files
2018-10-10 14:52:55 -07:00
Doug Bunting 3f001750ad
Rationalize code sharing between the three code generation projects
- #8417
- just two files needed to be moved&hellip;
2018-10-10 14:52:54 -07:00
Doug Bunting a76ca293ef
Add missing license headers to src files
- #8415
- also correct a typo in Microsoft.AspNetCore.Mvc.Testing files' headers
2018-10-10 14:52:54 -07:00
Doug Bunting d0325ef264
Remove `CodeAnnotations`
- #8416
- turns out this required little on top of dougbu/remove.custom.tool
2018-10-10 14:52:54 -07:00
Doug Bunting 6ffcf3571e
Remove T4 custom tool
- use same generator as most other projects in aspnet repos
  - were not using named arguments to resource methods anyhow
- update resources to use regular (numbered) format parameters
- adjust to new `Resources` namespace; no need for separate `using`
- use `Format...(...)` methods as necessary
2018-10-10 14:52:54 -07:00
Doug Bunting e19c036f11
Fix up MSBuild files
- correct filenames
- remove NSwag-specific files
2018-10-10 14:52:53 -07:00
Doug Bunting 25d0916b49
Use one namespace for the three client code generation projects
- also cleared out most uses of `GetDocument` and `GenerationTasks` in MSBuild and strings
- temporarily fixed up T4 templates, adding Resources.tt (will remove custom generation soon)
2018-10-10 14:52:53 -07:00
Doug Bunting 95b4dc8ca0
Add first cut of Microsoft.Extensions.ApiDescription.Client package / project
- WIP in a number of ways
2018-10-10 14:52:36 -07:00
James Newton-King 9daf5ff7a4
Fix PageRouteTransformerConvention with custom page routes (#8576) 2018-10-10 18:33:30 +13:00
Ryan Nowak 6cee2431f1 React to routing changes 2018-10-08 15:45:32 -07:00
David J. Quiroga 956441aa68 Ignore created URI if Assembly.CodeBase contains a fragment (#8556)
* Fixes #8367
2018-10-08 10:41:04 -07:00
Ryan Nowak 67a1f2dda9 Add security text about Host header 2018-10-05 22:26:37 -07:00
Ryan Nowak 384b814349 React to IEndpointSelectorPolicy changes 2018-10-05 21:03:53 -07:00
Doug Bunting 5bddd226a3
Use Internal.AspNetCore.Sdk as an MSBuild SDK
- should resolve issues with occasional strange MSBuild caching issues in this repo
- modeled after aspnet/Scaffolding#905
- follows aspnet/BuildTools#729 recommendation to check in global.config file
  - see also Microsoft/msbuild#2914
- use newer KoreBuild
  - `.\build.cmd -update /t:noop`
2018-10-04 15:12:38 -07:00
Pranav K 153165f9ad
Handle OPTIONS requests without a handler in Razor Pages (#8528)
* Handle OPTIONS requests without a handler in Razor Pages

Fixes #7438
2018-10-04 12:25:36 -07:00
Doug Bunting e2594c6a2b
Merge branch 'dougbu/no.more.dev' into release/2.2 2018-10-03 21:55:24 -07:00
James Newton-King 94101a9cde
Add PageRouteTransformerConvention (#8541) 2018-10-04 17:34:26 +13:00
Doug Bunting 8ad2da9da3
Quick fix: Remove dangling mentions of `dev` branches 2018-10-03 20:25:17 -07:00
James Newton-King 7854d65c11
Support page parameter in attribute route (#8530) 2018-10-04 14:39:40 +13:00
Alexej Timonin 70ddf15cbc MethodMatches 🚿 2018-10-02 12:57:18 -07:00
Pranav K a48e75dfb4
Implicitly set content type for ObjectResults containing ProblemDetails (#8512)
* Implicitly set content type for ObjectResults containing ProblemDetails

Fixes #8467
2018-10-02 10:24:38 -07:00
Ryan Nowak 3667b0481a React to routing API changes
Reaction for: https://github.com/aspnet/Routing/pull/822
2018-09-30 14:26:06 -07:00
ASP.NET CI 3e43cb0033 Update dependencies.props
[auto-updated: dependencies]
2018-09-30 12:25:19 -07:00
Ryan Nowak cb1393cbb1 Adding functional tests for LinkGenerator 2018-09-29 20:34:48 -07:00
Nate McMaster cc65115be1
automated: bulk infrastructure updates. Update bootstrapper scripts and remove unnecessary signing properties 2018-09-28 17:10:37 -07:00
Nate McMaster ef21286792
Fix microbuild code signing configuration (#8511)
Fixup the paths to files to be signed.
2018-09-28 10:36:56 -07:00
Pranav K ccb6579cd7
Do not return ProblemDetails for < 4xx status codes
Fixes #8504
2018-09-28 10:33:45 -07:00
Eilon Lipton d985f9ec44
Update LICENSE.txt 2018-09-27 15:46:08 -07:00
Pranav K 8311fd870b
Include the response type in ProducesResponseType for client errors (#8490)
* Include the response type in ProducesResponseType for client errors

* Refactor ActualApiResponseMetadata discovery in to a separate more manageable type
* Annotate action result ctors and helper methods that specify the "object" value with attribute
* Modify the discovery of parameters to match ActionResultObjectValueAttribute and ActionResultStatusCodeAttribute by name
  to allow users to write and annotate custom helper methods and action results, a la NotNullAttribute.

Fixes #8345
2018-09-26 15:51:49 -07:00
Pranav K 5b8b3a0067
Reference Microsoft.NET.Sdk.Razor in projects with Razor files (during benchmark builds) 2018-09-26 10:10:16 -07:00
Ryan Nowak 831937c86c Add LinkGenerator extensions for MVC 2018-09-26 09:37:46 -07:00
Pranav K 50cef4822a
Invoke FlushAsync before disposing the HttpResponseWriter in JsonResultExecutor
Fixes #8486
2018-09-24 13:00:56 -07:00
ASP.NET CI db7555b0ba Update dependencies.props
[auto-updated: dependencies]
2018-09-23 19:25:04 +00:00
Ryan Nowak 89a962716f React to Routing LinkGenerator changes 2018-09-22 15:47:38 -07:00
Doug Bunting 5c8dfef15e
Change `CollectionModelBinder` and `ComplexTypeModelBinder` to enforce `[BindRequired]`
- #8180
- add an error when binding fails for top-level model
  - same case as when MVC creates "default" / empty model i.e. `ParameterBinder` can't detect this
- update `CollectionModelBinder` subclasses and the various providers as well
- controlled by existing `MvcOptions.AllowValidatingTopLevelNodes` option

smaller issue:
- change `ModelBinding_MissingBindRequiredMember` resource to mention parameters too
2018-09-21 11:08:16 -07:00
Pranav K 61386d5f67
Reference Microsoft.NET.Sdk.Razor in projects with Razor files 2018-09-20 13:21:45 -07:00
Ryan Nowak 5c4c746797 Reaction PR from routing rename 2018-09-20 10:15:50 -07:00
Pranav K 9c424b7b02
Use content-type specified by ProducesAttribute if no formatter supports it
This allows users to use `ProducesAttribute` to specify the content-type
for action results such as FileStreamResult where the result determines the content type
and the specified value is informational.

Fixes https://github.com/aspnet/Mvc/issues/5701
2018-09-19 13:51:31 -07:00
Pranav K f7da3503d6 Allow Implicit 200 status codes to match Ok result 2018-09-19 12:51:13 -07:00
Pranav K c73b13f544
Cherry-pick @pranavkm's functional test for #7562
- 30a5eda508 / origin/prkrishn/form-file-value-provider

Was:
Design: Use a value provider to allow nested form files

Fixes https://github.com/aspnet/Mvc/issues/7562
2018-09-18 11:44:48 -07:00
Doug Bunting 47d6d4e82c
Update `FormFileModelBinder` to re-add prefix `ParameterBinder` removed incorrectly
- #7562 part 2
- add `OriginalModelName` to `ModelBindingContext`

nit: take VS suggestions, mostly to inline collection initialization in `FormFileModelBinderTest`
2018-09-18 11:44:48 -07:00