byjg / php-rest-reference-architecture

Boilerplate project template for create RESTFul services with docker and database integrated
MIT License
16 stars 3 forks source link

Error when generating REST file with composer run codegen command #11

Open cdenadai opened 6 months ago

cdenadai commented 6 months ago

When trying to generate a REST file using the command APP_ENV=dev composer run codegen -- --table example_crud rest --save or APP_ENV=dev composer run codegen -- --table example_crud all --save, the application is throwing an error indicating that the JwtContext class cannot be found. The reason for this error is that the import registered in the file is named Jwt instead of JwtContext.

Steps to reproduce Create an aplication composer -sdev create-project byjg/rest-reference-architecture ~/tutorial master Generate the file APP_ENV=dev composer run codegen -- --table example_crud rest --save or APP_ENV=dev composer run codegen -- --table example_crud all --save

Observe the error indicating that the JwtContext class cannot be found due to the import being registered as Jwt.

Expected behavior The composer run codegen command should be able to generate the REST file without errors due to the incorrect import of the JwtContext class.

Proposed solution Correct the import of the JwtContext class on templates/codegen/rest.php.jinja

From: use MyRest\Util\Jwt; To: use MyRest\Util\JwtContext;

byjg commented 6 months ago

You're right. It is an update is missing. I'll update this in a few minutes.

byjg commented 6 months ago

OK, a new commit was added and now everything should work fine.

Major changes:

LMK if it is working.