TYPO3-Documentation / TYPO3CMS-Reference-ViewHelper

Automatically generated ViewHelper reference
https://docs.typo3.org/other/typo3/view-helper-reference/master/en-us/
0 stars 17 forks source link

[TASK] Update data type for useNonce argument #79

Closed ErHaWeb closed 6 months ago

ErHaWeb commented 8 months ago

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

brotkrueml commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

@linawolf Do you have insight in here?

ErHaWeb commented 8 months ago

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 commented 8 months ago

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

brotkrueml commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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

ErHaWeb commented 6 months ago

My PR to change the generated XSD file https://github.com/TYPO3/Fluid.SchemaGenerator/pull/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 commented 6 months ago

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 commented 6 months ago

Pinged Simon about tagging.

brotkrueml commented 6 months ago

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 commented 6 months ago

@brotkrueml we can trigger rerendering here: https://github.com/TYPO3-Documentation/t3docs-ci-deploy/actions/workflows/fluid-viewhelper.yml

garvinhicking commented 6 months ago

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 commented 6 months ago

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 commented 6 months ago

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!