Commit Graph

4399 Commits

Author SHA1 Message Date
James Newton-King 6bb292cfcc
Add test for metadata precedence (#8642) 2018-10-27 07:59:15 +13:00
Pranav K 5656e7f455 React to CORS changes 2018-10-26 11:10:54 -07:00
Pranav K 2544926b2f Provide a convenience API to configure ApiBehaviorOptions 2018-10-24 10:10:33 -07:00
James Newton-King 40959a97e7
Fix link generation of routes with default values (#8616) 2018-10-23 16:10:43 +13:00
Ryan Nowak 76a30b0911 Remove LinkGenerationTemplate
This doesn't really accomplish our goals for 2.2 - I don't have a clear
scenario where I would tell a developer to use this VS something else.
Will reevaluate in 3.0
2018-10-21 15:39:59 -07:00
Patrick Westerhoff ddbe0fef26 Allow custom handling of antiforgery failures
To enable custom handling of antiforgery validation failures, use an
`AntiforgeryValidationFailedResult` which is just a `BadRequestResult`
but allows to be identified explicitly inside always-running result
filters using the `IAntiforgeryValidationFailedResult` marker interface.
2018-10-19 13:47:08 -07:00
Pranav K 8a183bb4f4 Allow serving Razor files with leading underscore
Fixes https://github.com/aspnet/Mvc/issues/8617
2018-10-19 13:43:35 -07:00
Pranav K 27e75e7a51
Add a switch to allow turning on ValidationVisitor shortcircuiting (#8599) 2018-10-17 15:47:01 -07:00
ASP.NET CI 10a94aa7bb
Update package branding for 2.2 RTM 2018-10-16 12:48:18 -07:00
Ryan Nowak a2a8a5ce36
Merge pull request #8598 from aspnet/rynowak/compat-version-docs
Update docs for compat switch value
2018-10-15 17:04:17 -07:00
Ryan Nowak c421178a22 Update docs for compat switch value 2018-10-15 07:43:18 -07:00
Pranav K fb57810f29 Shortcircuit validation when using default validator providers and no validation metadata is discovered
Fixes https://github.com/aspnet/Mvc/issues/5887
2018-10-12 14:47:06 -07:00
Pranav K a40c1f2d02 Use compat flag to drive XML ProblemDetails formatting 2018-10-12 14:15:28 -07:00
Pranav K 164d14064c Use casing for ProblemDetails that specified by RFC
* Use JsonProperty.MemberName to specify lowercase casing for ProblemDetails properties -
  https://tools.ietf.org/html/rfc7807#section-3
* Use XML NS and lowercase for Xml elements specified by RFC -
  https://tools.ietf.org/html/rfc7807#appendix-A

Fixes https://github.com/aspnet/Mvc/issues/8501
2018-10-12 14:15:28 -07:00
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