-
-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: examples generator #288
base: main
Are you sure you want to change the base?
Conversation
fd7c463
to
2564054
Compare
What about functions such as dates, etc? |
If you wish to add examples for the functions without a json file I see 2 options
On the other hand, instead of taking examples from data files we can generate examples using a rand function. |
I don't see any issue with this. |
I personally don't think it is a good idea. If you don't mind I would like to introduce a new json files instead. However I am not gonna block this issue just because of what I belives, so if you wish to make it in a different way I will be fine with other solution. |
The disadvantage of json files is that we need to maintain them. |
Yeah sure but what's the real cost of maintance of those files? Now I think about hybrid option, where 1 attempt is to use a data from file, but 2 attempt is to generate examples from function itself. What do you think? |
That's what I meant from the beginning. If we have a data file, use it; otherwise, produce it. |
b81b791
to
fb642a3
Compare
Suggested functionality was added. Now it look like this:
I belive someone more familiar with CI/CD could automate example generation. Or at least check my solution, I am not so sure about using |
7d09f46
to
c685cfa
Compare
I changed the way script is executed to give more flexability. |
894d276
to
e1150f5
Compare
Tell me if you see more issues to resolve before adding generator indicator to other files. |
Is something wrong? I would like to finish it, do you have something in mind you would like to clarify before merging? |
Can you please fix the conflicts? |
3da6e3b
to
c2792d2
Compare
c2792d2
to
d34136a
Compare
I fixed conflicts and added indicator to every file with generator. We already have 117 generated examples so I think we may consider closing this issue merging and releasing those examples and opening a new one with a bug.
|
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #268
What is the new behavior?
Does this PR introduce a breaking change?
Other information
I prepared a generator for examples since I don't want anyone to forget about updating those.
If you add
@automaticallyGeneratedExamples
in jsdoc and run generator, if the corresponding json file will be found it will put no more than 3 json file data elements after@example
jsdoc property.If there is no examples it will add new.
If there are already examples it will replace them.
Keep in mind that everything in comment after
@automaticallyGeneratedExamples
will be replaced by examples.Currently all files has well and consistent strucutre.
If something will be wrong with the files which are processed ( for example not consistent structure ) it will store an error and after processing list error array.
If generator fails somehow on generating it will store error and list of errors will be shown before the result of generation like.
If you have any questions feel free to ask.
I hope we will be able to enjoy this feature soon :)