We can also remove the parse parameter as it is not used anywhere.
The signature of the function should be encodeCharacters(str, { characterSet = 'reserved' } = {} and the logic for returning non-encoded strings for when the escape value is set to false should also be moved to valueEncoder.
encodeDisallowedCharacters
function https://github.com/swagger-api/swagger-js/blob/f327d4bd28aa5d3ed646b412f8ec9422fe55441a/src/execute/oas3/style-serializer.js#L5 contains logic that should be moved out of it - the function should only encode characters. We can move the logic for converting numbers to strings and returning empty strings or non-string type values to thevalueEncoder
function. It should take care of converting all values to strings as it does now for objects and arrays. https://github.com/swagger-api/swagger-js/blob/f327d4bd28aa5d3ed646b412f8ec9422fe55441a/src/execute/oas3/style-serializer.js#L59We can also remove the
parse
parameter as it is not used anywhere.The signature of the function should be
encodeCharacters(str, { characterSet = 'reserved' } = {}
and the logic for returning non-encoded strings for when theescape
value is set tofalse
should also be moved tovalueEncoder
.