Better handling of operationId with slashes (#2469)

* better handling of operation id with slashes

* update smaples
This commit is contained in:
William Cheng 2019-03-22 10:41:53 +08:00 committed by GitHub
parent b1955f3517
commit 2e777c04d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 31 additions and 26 deletions

View File

@ -3856,6 +3856,11 @@ public class DefaultCodegen implements CodegenConfig {
// input name and age => input_name_and_age
name = name.replaceAll(" ", "_");
// /api/films/get => _api_films_get
// \api\films\get => _api_films_get
name = name.replaceAll("/", "_");
name = name.replaceAll("\\\\", "_");
// remove everything else other than word, number and _
// $php_variable => php_variable
if (allowUnicodeIdentifiers) { //could be converted to a single line with ?: operator

View File

@ -82,11 +82,11 @@ instance HasBodyParam CreateXmlItem XmlItem
-- | @application/xml@
instance Consumes CreateXmlItem MimeXML
-- | @text/xml@
instance Consumes CreateXmlItem MimeTextxml
instance Consumes CreateXmlItem MimeTextXml
-- | @text/xml; charset=utf-8@
instance Consumes CreateXmlItem MimeTextxmlCharsetutf8
instance Consumes CreateXmlItem MimeTextXmlCharsetutf8
-- | @text/xml; charset=utf-16@
instance Consumes CreateXmlItem MimeTextxmlCharsetutf16
instance Consumes CreateXmlItem MimeTextXmlCharsetutf16
-- | @application/xml; charset=utf-8@
instance Consumes CreateXmlItem MimeXmlCharsetutf8
-- | @application/xml; charset=utf-16@

View File

@ -223,33 +223,33 @@ instance MimeType MimeXmlCharsetutf8 where
-- instance MimeRender MimeXmlCharsetutf8 T.Text where mimeRender _ = undefined
-- instance MimeUnrender MimeXmlCharsetutf8 T.Text where mimeUnrender _ = undefined
-- ** MimeTextxml
-- ** MimeTextXml
data MimeTextxml = MimeTextxml deriving (P.Typeable)
data MimeTextXml = MimeTextXml deriving (P.Typeable)
-- | @text/xml@
instance MimeType MimeTextxml where
instance MimeType MimeTextXml where
mimeType _ = Just $ P.fromString "text/xml"
-- instance MimeRender MimeTextxml T.Text where mimeRender _ = undefined
-- instance MimeUnrender MimeTextxml T.Text where mimeUnrender _ = undefined
-- instance MimeRender MimeTextXml T.Text where mimeRender _ = undefined
-- instance MimeUnrender MimeTextXml T.Text where mimeUnrender _ = undefined
-- ** MimeTextxmlCharsetutf16
-- ** MimeTextXmlCharsetutf16
data MimeTextxmlCharsetutf16 = MimeTextxmlCharsetutf16 deriving (P.Typeable)
data MimeTextXmlCharsetutf16 = MimeTextXmlCharsetutf16 deriving (P.Typeable)
-- | @text/xml; charset=utf-16@
instance MimeType MimeTextxmlCharsetutf16 where
instance MimeType MimeTextXmlCharsetutf16 where
mimeType _ = Just $ P.fromString "text/xml; charset=utf-16"
-- instance MimeRender MimeTextxmlCharsetutf16 T.Text where mimeRender _ = undefined
-- instance MimeUnrender MimeTextxmlCharsetutf16 T.Text where mimeUnrender _ = undefined
-- instance MimeRender MimeTextXmlCharsetutf16 T.Text where mimeRender _ = undefined
-- instance MimeUnrender MimeTextXmlCharsetutf16 T.Text where mimeUnrender _ = undefined
-- ** MimeTextxmlCharsetutf8
-- ** MimeTextXmlCharsetutf8
data MimeTextxmlCharsetutf8 = MimeTextxmlCharsetutf8 deriving (P.Typeable)
data MimeTextXmlCharsetutf8 = MimeTextXmlCharsetutf8 deriving (P.Typeable)
-- | @text/xml; charset=utf-8@
instance MimeType MimeTextxmlCharsetutf8 where
instance MimeType MimeTextXmlCharsetutf8 where
mimeType _ = Just $ P.fromString "text/xml; charset=utf-8"
-- instance MimeRender MimeTextxmlCharsetutf8 T.Text where mimeRender _ = undefined
-- instance MimeUnrender MimeTextxmlCharsetutf8 T.Text where mimeUnrender _ = undefined
-- instance MimeRender MimeTextXmlCharsetutf8 T.Text where mimeRender _ = undefined
-- instance MimeUnrender MimeTextXmlCharsetutf8 T.Text where mimeUnrender _ = undefined

View File

@ -1,7 +1,7 @@
{
"name": "open_api_petstore",
"version": "1.0.0",
"description": "This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters__",
"description": "This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters___",
"license": "Apache-2.0",
"main": "dist/index.js",
"scripts": {

View File

@ -66,7 +66,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___.<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:

View File

@ -1,7 +1,7 @@
{
"name": "open_api_petstore",
"version": "1.0.0",
"description": "This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters__",
"description": "This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters___",
"license": "Apache-2.0",
"main": "dist/index.js",
"scripts": {

View File

@ -66,7 +66,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___.<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:

View File

@ -1,7 +1,7 @@
{
"name": "open_api_petstore",
"version": "1.0.0",
"description": "This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters__",
"description": "This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters___",
"license": "Apache-2.0",
"main": "src/index.js",
"scripts": {

View File

@ -25,7 +25,7 @@
'use strict';
/**
* 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___.<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:

View File

@ -1,7 +1,7 @@
{
"name": "open_api_petstore",
"version": "1.0.0",
"description": "This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters__",
"description": "This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters___",
"license": "Apache-2.0",
"main": "src/index.js",
"scripts": {

View File

@ -25,7 +25,7 @@
'use strict';
/**
* 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___.<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: