Javascript Generator: two small sanitization changes 🦠 (#13268)

* Javascript Generator: small sanitization changes

Sanitize module name, do not sanitize description.

If we set the project name to "@myorg/mypackage" (scoped package[1]), running `npm test` will fail, as it will generate faulty code due to the module name including the '@' symbol, which is not a valid JS identifier.

Additionally, we don't need to sanitize the description - spaces and special characters are fine. We just need to make sure they are escaped, which we're already doing by invoking escapeText() on line 329

[1]anitize module name, do not sanitize description

* update JS samples
This commit is contained in:
João Neto
2022-08-24 17:18:30 +02:00
committed by GitHub
parent b9a6be0cba
commit 1a5d3926b3
5 changed files with 6 additions and 6 deletions

View File

@@ -69,7 +69,7 @@ import UserApi from './api/UserApi';
/**
* This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters___.<br>
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \&quot; \\.<br>
* The <code>index</code> module provides access to constructors for all the classes which comprise the public API.
* <p>
* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: