Skip to content

Missing keys in model #434

@sambousek

Description

@sambousek

class CreatePipelineConfigurationParameters(Model):

The documentation for creating a pipeline is missing several required keys in the pipeline configuration.

For example, to create a pipeline from a yaml, this is the body of the POST that is required:

{
    "configuration": {
        "variables": {
            "python.version": {
                "value": "3.9.x"
            }
        },
        "path": "pipelines/unit_test_pipeline.yml",
        "repository": {
            "id": "<repo id>",
            "type": "azureReposGit"
        },
        "type": "yaml"
    },
    "name": "Sandbox Testing - Dev",
    "folder": "\\Sandbox"
}

but according to the documentation, this is all that is required

{
    "configuration": {
        "type": "yaml"
    },
    "name": "Sandbox Testing - Dev",
    "folder": "\\Sandbox"
}

The API models filter out the extra keys, and then the create_pipeline() call fails because the required keys are missing

C:\Python39\lib\site-packages\azure\devops\v6_0\pipelines\pipelines_client.py:123: in create_pipeline
    response = self._send(http_method='POST',
C:\Python39\lib\site-packages\azure\devops\client.py:104: in _send
    response = self._send_request(request=request, headers=headers, content=content, media_type=media_type)
C:\Python39\lib\site-packages\azure\devops\client.py:68: in _send_request
    self._handle_error(request, response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <azure.devops.v6_0.pipelines.pipelines_client.PipelinesClient object at 0x000001C0A238CBE0>
request = <ClientRequest [POST]>, response = <Response [400]>

    def _handle_error(self, request, response):
        content_type = response.headers.get('Content-Type')
        error_message = ''
        if content_type is None or content_type.find('text/plain') < 0:
            try:
                wrapped_exception = self._base_deserialize('WrappedException', response)
                if wrapped_exception is not None and wrapped_exception.message is not None:
>                   raise AzureDevOpsServiceError(wrapped_exception)
E                   azure.devops.exceptions.AzureDevOpsServiceError: Value cannot be null.
E                   Parameter name: Path

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions