proofit404 / stories

Service objects designed with OOP in mind.
https://proofit404.github.io/stories/
BSD 2-Clause "Simplified" License
297 stars 21 forks source link

Question: A way to see initial attributes for a story like @attributes in version 0.15.0 #728

Closed M0dM closed 2 months ago

M0dM commented 2 months ago

Hi @proofit404,

We are using stories since a while now and are trying to migrate to the latest version.

In v0.15.0 and may other we had an @arguments decorator like this. @arguments("category_id", "price_id", "user_id")

Using the State object from latest version we do not have anymore an easy way to find initial state values before story execution.

A workaround / implementation I am thinking about is a dataclass allowing extra arguments (See https://github.com/pydantic/pydantic/discussions/7362#discussioncomment-6947058 with pydantic for example) called MyStoryState and we could use it as a type of the State instance to find out easyly initial story arguments.

What do you think about this ?

Is there anything already supported natively in the new version of Stories ?

M0dM commented 2 months ago

Ok, nevermind, already found this :

https://proofit404.github.io/stories/state/#only-declared-arguments-could-be-passed

We will have a closer look.