task: metadata: install: pip install -e .[dev]
patch: diff --git a/autorest/codegen/models/parameter_list.py b/autorest/codegen/models/parameter_list.py
index 5f1c8b94f..500a776b3 100644
--- a/autorest/codegen/models/parameter_list.py
+++ b/autorest/codegen/models/parameter_list.py
@@ -115,16 +115,17 @@ class ParameterList(MutableSequence):
                 or parameter.is_kwarg
             )
 
-        signature_parameters_required = []
-        signature_parameters_optional = []
+
+        signature_parameters_no_default_value = []
+        signature_parameters_default_value = []
         for parameter in self.parameters:
             if is_parameter_in_signature(parameter):
-                if parameter.required:
-                    signature_parameters_required.append(parameter)
+                if not parameter.client_default_value and parameter.required:
+                    signature_parameters_no_default_value.append(parameter)
                 else:
-                    signature_parameters_optional.append(parameter)
+                    signature_parameters_default_value.append(parameter)
 
-        signature_parameters = signature_parameters_required + signature_parameters_optional
+        signature_parameters = signature_parameters_no_default_value + signature_parameters_default_value
         return signature_parameters
 
     @property

problem_statement: argument order syntax error 

Using

>  AutoRest code generation utility [cli version: 3.0.6187; node: v10.13.0, max-memory: 8192 gb]

With: Autorest for Python v5.0.0 - 20200228.1

And Swagger:

https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/search/data-plane/Microsoft.Azure.Search.Data/stable/2019-05-06/searchindex.json

generates this output:

```
def __init__(
        self,
        search_service_name,  # type: str
        search_dns_suffix="search.windows.net",  # type: str
        index_name,  # type: str
        **kwargs  # type: Any
    ):
```
Which is

> SyntaxError: non-default argument follows default argument
repo: Azure/autorest.python
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/test/unittests/test_parameter_ordering.py b/test/unittests/test_parameter_ordering.py
new file mode 100644
index 000000000..ce4e06df7
--- /dev/null
+++ b/test/unittests/test_parameter_ordering.py
@@ -0,0 +1,59 @@
+import pytest
+from autorest.codegen.models import Parameter, AnySchema
+from autorest.codegen.models.parameter_list import ParameterList
+from autorest.codegen.models.parameter import ParameterLocation
+
+def get_parameter(name, required, default_value=None):
+    schema = AnySchema(
+        namespace="parameterordering",
+        yaml_data={}
+    )
+    return Parameter(
+        schema=schema,
+        yaml_data={},
+        rest_api_name=name,
+        serialized_name=name,
+        description="Parameter to test parameter ordering",
+        implementation="Method",
+        required=required,
+        location=ParameterLocation.Path,
+        skip_url_encoding=True,
+        constraints=[],
+        client_default_value=default_value
+    )
+
+def test_sort_required_parameters():
+    required_default_value_parameter = get_parameter(
+        name="required_default_value_parameter",
+        required=True,
+        default_value="hello"
+    )
+    required_parameter = get_parameter(
+        name="required_parameter",
+        required=True
+    )
+
+    parameter_list = [required_parameter, required_default_value_parameter]
+
+    assert [required_parameter, required_default_value_parameter] == ParameterList(parameter_list).method
+
+    # switch around ordering to confirm
+
+    parameter_list = [required_default_value_parameter, required_parameter]
+
+    assert [required_parameter, required_default_value_parameter] == ParameterList(parameter_list).method
+
+def test_sort_required_and_non_required_parameters():
+    required_parameter = get_parameter(
+        name="required_parameter",
+        required=True
+    )
+
+    optional_parameter = get_parameter(
+        name="optional_parameter",
+        required=False
+    )
+
+    parameter_list = [optional_parameter, required_parameter]
+
+    assert [required_parameter, optional_parameter] == ParameterList(parameter_list).method
\ No newline at end of file