Custom resource name is not being honoured /RFC
See original GitHub issueIssue
Currently when you add a Resource(..)
attribute to a resource in the DbContext
as such:
[Resource("weird-NaMiNg")]
public virtual DbSet<SuperNiceModel> SuperNiceModels { get; set; }
The name SuperNiceModels
(the property name) is being used to create an URL and type identifier. The following identifier is used because of that: superNiceModels
. What is the weird-NaMiNg
identifier actually being used for?
Solutions
Two way to approach this:
First Version
If i add a Resource("cookiesMcCookieFace")
To a mobel in my DbContext
, I expect two things:
- An overridden url
/api/v1/cookiesMcCookieFace
- An overriden type
{'type' : 'cookiesMcCookieFace'}
.
Second Version
If i add a Resource(url: 'cookiesMcCookieFace', type: 'cookie')
To a mobel in my DbContext
, I expect two things:
- An overridden url
/api/v1/cookiesMcCookieFace
- An overriden type
{'type' : 'cookie'}
.
Thoughts?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
AWS::CloudFormation::CustomResource
Updates aren't supported. Required: Yes. Type: String. Update requires: Replacement. Remarks. Specifying custom resource type names. For custom resources, ...
Read more >RFC 9110 - HTTP Semantics
HTTP Semantics (RFC 9110, June 2022) ... Determining the Target Resource ... Likewise, servers do not need to be aware of each client's...
Read more >RFC 7231 HTTP/1.1 Semantics and Content
HTTP does not limit the nature of a resource; it merely defines an interface that ... by a case-insensitive token. charset = token...
Read more >Custom resources - AWS CloudFormation
Specifies custom resources so that non-AWS resources can be included in an AWS CloudFormation stack by using the AWS::CloudFormation::CustomResource ...
Read more >RFC 7230: Hypertext Transfer Protocol (HTTP/1.1)
Likewise, servers do not need to be aware of each client's purpose: an HTTP ... for a potential target resource within that origin...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
With respect to the urlIdentifier part of the approach, I’ve been giving it a second thought. In JADNC v3.1 the url part was generated based on the controller:
Note that this is just a .NET Core off-the-shelve feature. The only thing that JADNC did was to apply a casing convention (.net cores default PascalCase to kebab-case). (Also note that
ResourceAttribute
never affected the url part in v3.1)What happened in v4 is that the link between controller/url and associated link was registered internally so that we could populate the CurrentRequest service in the middleware rather than in the controller layer. I think an unwanted change there is that the calculation of URL changed: it moved from controller-based to model-based, i.e.
CustomBarFooController
now maps to/{namespace}/foo-bar
. This is what brought about the unexpected routing changes in your projects. (And of course, also kebab-case was changed to camelCase).I would be in favour of reverting this change and generate the URL based on the controller again to fix the issue your faced:
Superseded by #786 and the associated PR. Decisions about this topic have been made there. More info about the current approach is described here