Skip to content

Upgrade jmustache to 1.16#18314

Closed
gemyago wants to merge 1 commit intoOpenAPITools:masterfrom
gemyago:feature/jmustache-to-1.16
Closed

Upgrade jmustache to 1.16#18314
gemyago wants to merge 1 commit intoOpenAPITools:masterfrom
gemyago:feature/jmustache-to-1.16

Conversation

@gemyago
Copy link
Copy Markdown

@gemyago gemyago commented Apr 7, 2024

Includes upgrade to jmustache to 1.16

@gemyago
Copy link
Copy Markdown
Author

gemyago commented Apr 8, 2024

we will need to investigate further and update the templates if needed to address the issue due to the upgrade.

I'll try to run it locally as per docs. Very likely whitespace changes.

@gemyago
Copy link
Copy Markdown
Author

gemyago commented Apr 8, 2024

couldn't get local build working as well as build in docker, will try some other day. Closing this PR for now.

@gemyago gemyago closed this Apr 8, 2024
@peter-jerry-ye
Copy link
Copy Markdown

peter-jerry-ye commented Aug 14, 2024

Hi,

I wanted to contribute a new sdk and I'd like to use the parent feature of mustache, which is available in 1.16, so I came across this PR.

From what I observe, the changes are whitespace changes. Many of them (if not all of them) are caused by a partial that does not have a trailing newline but was generated with a newline before:

For example, take the samples/client/echo_api/php-nextgen/docs/Api/PathApi.md as an example, it will have line 25 deleted after the upgrade (trailing whitelines 3 -> 2).

Before:

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new OpenAPI\Client\Api\PathApi(

After:

<?php
require_once(__DIR__ . '/vendor/autoload.php');


$apiInstance = new OpenAPI\Client\Api\PathApi(

The relevant template:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

{{> php_doc_auth_partial}}
$apiInstance = new {{invokerPackage}}\Api\{{classname}}(

Where the php_doc_auth_partial.mustache should provide only one empty line if I understand correctly

{{#hasAuthMethods}}{{#authMethods}}
{{! Removed for simplicity }}
{{/authMethods}}{{/hasAuthMethods}}{{! There's a trailing new line after this }}

So in theory, I think the new behavior is correct (though I'm not sure why it behaved as such before), but this will require adding newlines in each of the partials.

@peter-jerry-ye
Copy link
Copy Markdown

peter-jerry-ye commented Aug 16, 2024

@takanuva15
Copy link
Copy Markdown

takanuva15 commented Sep 10, 2024

@peter-jerry-ye I'm also interested in getting jmustache upgraded to 1.16 to take advantage of parents and inheritance. Maybe I can try make a new PR since gemyago abandoned this PR

UPDATE: Made a new PR at #19575

@takanuva15 takanuva15 mentioned this pull request Sep 13, 2024
5 tasks
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