GithubHelp home page GithubHelp logo

Comments (9)

ben221199 avatar ben221199 commented on August 16, 2024 1

Maybe you could do something with debug mode? Performance is less important when debugging locally why something doesn't work.

from laravel.

ben221199 avatar ben221199 commented on August 16, 2024

Can you show the php artisan route:list?

from laravel.

matthijs avatar matthijs commented on August 16, 2024

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.

ben221199 avatar ben221199 commented on August 16, 2024

I think the '\\' . is not neccessary.

Do you also have the schema?

from laravel.

matthijs avatar matthijs commented on August 16, 2024

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.

ben221199 avatar ben221199 commented on August 16, 2024

Yeah, that makes sense. I had the feeling it had something to do with the ID anyway.

from laravel.

ben221199 avatar ben221199 commented on August 16, 2024

@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 avatar lindyhopchris commented on August 16, 2024

@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.

matthijs avatar matthijs commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.