Skip to content
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

[TASK] Update data type for useNonce argument #79

Closed
wants to merge 1 commit into from

Conversation

ErHaWeb
Copy link

@ErHaWeb ErHaWeb commented Mar 7, 2024

According to TYPO3\CMS\Fluid\ViewHelpers\Asset\CssViewHelper and TYPO3\CMS\Fluid\ViewHelpers\Asset\ScriptViewHelper the argument useNonce should be of type boolean.

According to `TYPO3\CMS\Fluid\ViewHelpers\Asset\CssViewHelper` and `TYPO3\CMS\Fluid\ViewHelpers\Asset\ScriptViewHelper` the argument `useNonce` should be of type `boolean`.
@brotkrueml
Copy link

These files are generated automatically. So, if it is in the docblocks of the view helper classes, we have to investigate why they are not correct in the docs.

@ErHaWeb
Copy link
Author

ErHaWeb commented Mar 7, 2024

Ok, there seems to be a broader problem with different valid data types for ViewHelper arguments. string and integer are output correctly but it seems that almost all other data types such as object or bool are generally documented as mixed. Could there be a general problem with the mapping of data types when rendering the documentation?

@brotkrueml
Copy link

@linawolf Do you have insight in here?

@ErHaWeb
Copy link
Author

ErHaWeb commented Mar 7, 2024

With regard to the data type boolean, the TemplateParser accepts both the designation bool (as in the argument useNonce of the CssViewHelper) and boolean (as in the argument priority of the CssViewHelper). The latter is output correctly in the documentation, the former is not.
https://github.com/TYPO3/Fluid/blob/main/src/Core/Parser/TemplateParser.php#L569

@brotkrueml
Copy link

Thanks for investigating, just looking for the repo where this is handled.

@brotkrueml
Copy link

brotkrueml commented Mar 7, 2024

This seems to be the place where the "mixed" comes from:
https://github.com/TYPO3-Documentation/fluid-documentation-generator/blob/b00dd00a86e087f473b108f33fd711744ec9af67/src/Export/RstExporter.php#L173

There seems to be a schema.xsd to be loaded. I assume, this schema generator does not handle the bool. This one? https://github.com/TYPO3/Fluid.SchemaGenerator

@ErHaWeb
Copy link
Author

ErHaWeb commented Mar 7, 2024

This is where the type mapping is located when generating the XSD file:
https://github.com/TYPO3/Fluid.SchemaGenerator/blob/main/src/SchemaGenerator.php#L157-L175
and here are the corresponding test values
https://github.com/TYPO3/Fluid.SchemaGenerator/blob/main/tests/Unit/SchemaGeneratorTest.php#L54-L66
As you can see, only the type boolean is handled there, not bool as also accepted by the TemplateParser.

@ErHaWeb
Copy link
Author

ErHaWeb commented Mar 7, 2024

PR to add the correct interpretation of the "bool" notation in the SchemaGenerator has been created:
TYPO3/Fluid.SchemaGenerator#16

@ErHaWeb
Copy link
Author

ErHaWeb commented May 7, 2024

My PR to change the generated XSD file TYPO3/Fluid.SchemaGenerator#16 has been merged. What will happen now? Will the documentation be recreated in the foreseeable future on the basis of the new XSD file or does this process still need to be explicitly initiated by someone?

@brotkrueml
Copy link

The view helper reference was rendered recently:

image

But the change is not available, yet. I assume, we need a tag, so this change is picked up for the rendering chain.

@brotkrueml
Copy link

Pinged Simon about tagging.

@brotkrueml
Copy link

new tag is available

@linawolf Do you know, how to trigger a new commit of the changes? The content is still old:
https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-ViewHelper/blob/main/Documentation/typo3/fluid/latest/Asset/Css.rst#usenonce

@linawolf
Copy link
Member

linawolf commented May 7, 2024

@garvinhicking
Copy link
Contributor

If I read the workflow file correctly, it's also created once a day (at 1 am) via crontab.

The latest workflow however shows an error that seems to use PHP 8.1 instead of PHP 8.2 and I'm quite stumped how that happens; the "main" job does set-up PHP 8.2, so why isn't it available...

@linawolf
Copy link
Member

linawolf commented May 9, 2024

Good hint! I will investigate. I was recently making some other changes to the fluid-documentation-generator and they might have an effect here

@linawolf
Copy link
Member

linawolf commented May 9, 2024

So the rendering now worked and the nonce argument is displayed as boolean:
https://docs.typo3.org/other/typo3/view-helper-reference/main/en-us/typo3/fluid/latest/Asset/Css.html#asset.css_usenonce

@ErHaWeb thanks a lot for supplying the patch in the schema generator!

@linawolf linawolf closed this May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants