-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Feature: Allow user to override or expand package mappings #74
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add config tag
add new custom_mappings to config, fix typo
Add new getMappings method, takes default mappings and merges them with custom_mappings from config, set keys to lowercase
Add modeltyper to cSpell.words
Use LazilyRefreshDatabase
Add new action GetMappings, move getMappings from TypescriptMappings to GetMappings class
Initialize $mappings in Generator class, and pass it down. Remove timestampsDate from classes, replace it with mappings array.
Fix old test Add tests for GetMappings class
Fix Call to an undefined method ReflectionType::getName As of php 8.1 ReflectionMethod::getReturnType can return ReflectionNamedType|ReflectionUnionType|ReflectionIntersectionType|null, but only ReflectionNamedType implements getName method
rename phpstan.neon to phpstan.neon.dist to allow per machine config
Fix warning "Node.js 16 actions are deprecated" Remove unsuported laravel 9 from test.yml
Thanks for the PR, looking into this now! (sorry for the delay) |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add a new key
custom_mappings
to the config, allows the user to override existing mappings, or add new ones likePoint
from geometry, or missing ones likecharacter
from #73.For this, a new Action was created
GetMappings
, This action takes the package mappings, merges them with the ones in config, and set all the keys to lowercase (becauseMapReturnType::class
expects them to be lowercase).It's initialized in
Generator
class, passed down toGenerateJsonOutput/GenerateCliOutput
, then toWriteColumnAttribute
and finally toMapReturnType
.It's not pretty, but it works, I would prefer to access those mappings and the commands arguments from a Facade.
A side effect is that you now can cast classes like
Custom Casts
globally, instead of per model.Added some test, for
GetMappings
, andComplexModel
withCustom Casts
casted from config.Rename
phpstan.neon
tophpstan.neon.dist
to allow per machine config, fix ignored error in phpstan.Update github workflows, remove unsupported Laravel 9 from matrix, update actions (Warning: Node.js 16 actions are deprecated), use phpstan.neon.dist in phpstan.yml
Added
character
as string toTypescriptMappings
, fixes #73.Update
readme.md