Comments (9)
Maybe you could do something with debug mode? Performance is less important when debugging locally why something doesn't work.
from laravel.
Can you show the php artisan route:list
?
from laravel.
Sure, here it is (only the routes related to this problem):
GET|HEAD api/v1/external-service-provider-activities ....................................................... api.v1.external-service-provider-activities.index › LaravelJsonApi\Laravel › JsonApiController@index
GET|HEAD api/v1/external-service-provider-activities/{esp_activity} .......................................... api.v1.external-service-provider-activities.show › LaravelJsonApi\Laravel › JsonApiController@show
The index is action is working correctly.
from laravel.
I think the '\\' .
is not neccessary.
Do you also have the schema?
from laravel.
Ok, nevermind. I found the problem.
In our schema we had a double ID::make()
definition like:
/**
* Get the resource fields.
*/
public function fields(): array
{
return [
ID::make()->uuid(),
Str::make('name')->sortable(),
Str::make('description')->sortable(),
ID::make('chain')->sortable(); // causing the trouble...
DateTime::make('created_at')->sortable()->readOnly(),
DateTime::make('updated_at')->sortable()->readOnly(),
];
}
The fact that ID::make('chain')->sortable()
had no ->uuid()
did change the regex for the route pattern to an integer regex. And that caused the 404 not found exception.
Thanks for trying to help out and sorry for the trouble.
Maybe check if there are multiple ID::make()
definitions returned and throw an exception in that case? That could help catching this kind of bug earlier...
from laravel.
Yeah, that makes sense. I had the feeling it had something to do with the ID
anyway.
from laravel.
@lindyhopchris Is this an option in some way?
Maybe check if there are multiple ID::make() definitions returned and throw an exception in that case? That could help catching this kind of bug earlier...
from laravel.
@lindyhopchris Is this an option in some way?
Maybe check if there are multiple ID::make() definitions returned and throw an exception in that case? That could help catching this kind of bug earlier...
So "checking something" has cost, that you incur every single time the schema is created in a request. Just to catch a mistake a developer has made...
I'll take a look but will only do something if it doesn't add in any extra processing.
from laravel.
So "checking something" has cost, that you incur every single time the schema is created in a request. Just to catch a mistake a developer has made...
I'll take a look but will only do something if it doesn't add in any extra processing.
I completely agree! For debugging purposes it would be handy if this could be catched but if that has a performance hit in production then please leave it out. Maybe add an extra note to the documentation about this.
from laravel.
Related Issues (20)
- Feature Requests: Inject Scopes middleware option HOT 5
- Best location to add cache for API get requests HOT 2
- Customize top-level meta when fetching related resource HOT 1
- Problem with countables relationships HOT 15
- Incorrect data serialization within ArrayHash (Hashable trait) HOT 1
- [question] Validation on filter values HOT 4
- How to create resource belongsTo resource in one request? HOT 3
- Controllers cannot be placed in a custom namespace HOT 5
- Rules in a a ResourceRequest are not checked against the Schema's defined fields; no exception thrown for an incorrect Request HOT 2
- [Feature Request] Nesting Filters HOT 1
- Included morph to many data is `null` HOT 5
- Updating a model's relationships where the policy denies updating the relationship gives 200 OK, but doesn't update the relationship HOT 5
- Impossible to change route model binding? HOT 5
- Proper docs for v4.0 and Laravel 11.x HOT 1
- Exception Handling with Laravel 11.x HOT 8
- Filtering inlcuded resources HOT 1
- Error when handling validation failures HOT 5
- QueryToMany, QueryToOne, HasMany, HasOne, BelongsTo and BelongsToMany may fail to find a relation if declared with resolveRelationUsing HOT 3
- Add Where Any / All Filters HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel.