Conversation
…ther prototypes
The prototype `PackageFactory.AtomicFusion.PropTypes:ForPrototype` allows to define a DataStructureValidator for all props
of the prototype specified via `prototypeName`.
```
@propTypes {
button = PackageFactory.AtomicFusion.PropTypes:ForPrototype {
prototypeName = 'Vendor.Site:Button'
}
}
```
Additionally:
- seperate shape validators are removed ... shape is now an alias for datastructure
- fusion-prototypes for Bool, Float, Int, String, DataStructure, ArrayOf, AnyOf, OneOf are added
d042c4b to
f46b05e
Compare
ForPrototype protype to use propTypes from other fusion prototypes
|
hi öhm #17 hmmm |
…evaluateNestedProperties
|
@mhsdesign did not see that, sorry ... however this pr allows to specify all proptypes as fusion object |
ForPrototype protype to use propTypes from other fusion prototypesForPrototype protype to use propTypes from other fusion prototypes
|
|
||
| class AnyOfImplementation extends AbstractArrayFusionObject | ||
| { | ||
| use AbstractValidatorTrait; |
|
|
||
| public function createValidator(): DataStructureValidator | ||
| { | ||
| $prototypeName = $this->fusionValue('prototypeName'); |
There was a problem hiding this comment.
i would argue that "prototype" is the wrong name, its too unspecific propTypes can only be used with components ... so how about ForComponent and componentName ?
There was a problem hiding this comment.
Used it as it is the same as in Sitegeist.Monocle:PreviewPrototype ... bettter suggestions are welcome. Also it would be great to specify a prototype not as string. Did not find a good way to achieve this.
There was a problem hiding this comment.
i now some dark magic so you can do
type = Foo.Bar
(without strings ^^)
but thats not really tge fusion way, i think people got used to it ...
There was a problem hiding this comment.
Und dann runtime->evaluate->("type/__meta/propTypes"); ... hmmm really dark. If we find a way to achieve this in a way that works for Sitegeist.Monocle:PreviewPrototype i would love to see this.
There was a problem hiding this comment.
hmm one can access the object name via $this->properties["type"]['__objectType'] ;)
(tested)
There was a problem hiding this comment.
@mhsdesign Would still like to go with "string:prototypeName" first. If we find ab better way we can implement the same solution in monocle and here.
|
@grebaldi i wonder how this could be adapted to Sitegeist.Monocle.PropTypes ... pretty sure there is a way but i do not see it yet. |
|
this is how short aliases could look: What i would still like to change / discuss:
|
|
IDEA: combine OneOf and AnyOf |
... also added short aliases for the propTypes
ForPrototype protype to use propTypes from other fusion prototypesPropTypes:ForPrototype protype to use propTypes from other fusion prototypes
PropTypes:ForPrototype protype to use propTypes from other fusion prototypesPropTypes:ForPrototype to use propTypes from other fusion prototypes
36952cf to
741b7cc
Compare
grebaldi
left a comment
There was a problem hiding this comment.
Hi @mficzel,
thanks for building this 👍 , I like the idea.
I added some conceptual comments, but mostly typo stuff :)
RE @mficzel:
@grebaldi i wonder how this could be adapted to Sitegeist.Monocle.PropTypes ... pretty sure there is a way but i do not see it yet.
Oh, I'd be very pleased to take a look at that :)
RE @mficzel:
IDEA: combine OneOf and AnyOf
+1 - And to reduce confusion even more, I'd like to suggest to drop the react-proptypes API naming in this case and call the combined one Union:
myValue = PropsTypes:Union {
0 = PropTypes:Int
1 = PropTypes:Float
}
|
i mus say i also really like |
- rename OneOf to Union - rename ArrayOf to Array
2e99613 to
613ace3
Compare
|
I added PropTypes:Union and PropTypes:Enum as those are distinct cases. Other than that i think it might actually be ready now. I kept "prototypeName" for now as it is in line with what Monocle:PreviewPrototype does. Once we have a better solution there i would like to add a "type" that accepts a FusionPrototype without Quotes in another PR. |
PropTypes:ForPrototype to use propTypes from other fusion prototypesPropTypes:FromPrototype to use propTypes from other fusion prototypes
…facade This ensures that the solution is compatible with the upcoming changes in proptypes PackageFactory/atomic-fusion-proptypes#20
|
@grebaldi prepared the adjustments for monocle-proptypes. Seems to work with buth styles of proptypes ... do you consider this approach valid |
…facade This ensures that the solution is compatible with the upcoming changes in proptypes PackageFactory/atomic-fusion-proptypes#20
…facade This ensures that the solution is compatible with the upcoming changes in proptypes PackageFactory/atomic-fusion-proptypes#20
…facade This ensures that the solution is compatible with the upcoming changes in proptypes PackageFactory/atomic-fusion-proptypes#20
The prototype
PackageFactory.AtomicFusion.PropTypes:ForPrototypeallows to define a DataStructureValidator for all props of the prototype specified viaprototypeName.Resolves: #16
In addition prototypes are added that allow to specify validation in fusion instead of eel
Additionally:
Neos.Fusion:RawArrayfrom dynamic@propTypespath evaluation #18