Skip to content

fix: omit empty project and language keys in azure.yaml#8918

Closed
huimiu wants to merge 2 commits into
mainfrom
hui/didactic-guacamole
Closed

fix: omit empty project and language keys in azure.yaml#8918
huimiu wants to merge 2 commits into
mainfrom
hui/didactic-guacamole

Conversation

@huimiu

@huimiu huimiu commented Jul 1, 2026

Copy link
Copy Markdown
Member

Problem

azd ai agent init generates an azure.yaml where the code-less resource service (host: azure.ai.project) is written with project: "" and language: "":

services:
  hui-proj-ncus:
    project: ""
    host: azure.ai.project
    language: ""
    ...

The azure.yaml schema disables project for these code-less hosts ("project": false for azure.ai.project, azure.ai.connection, azure.ai.toolbox, azure.ai.skill, azure.ai.routine), so the generated file fails validation with "Property project is not allowed."

Root cause

ServiceConfig.RelativePath (yaml:"project") and ServiceConfig.Language (yaml:"language") had no omitempty, so project.Save always emitted them — even for code-less resource hosts that legitimately have no source path or language.

Fix

Add omitempty to RelativePath and Language. Traditional/container hosts always set these, so their output is unchanged; only empty values (code-less hosts) are now omitted.

Tests

Added TestCodelessServiceOmitsProjectAndLanguage verifying an azure.ai.project service serializes without project:/language: keys. Full pkg/project and internal/grpcserver suites pass.

Copilot AI review requested due to automatic review settings July 1, 2026 14:56
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

🔗 Linked Issue Required

Thanks for the contribution! Please link a GitHub issue to this PR by adding Fixes #123 to the description or using the sidebar.
No issue yet? Feel free to create one!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes azure.yaml generation/saving so code-less resource hosts (e.g., host: azure.ai.project) no longer serialize invalid empty project: "" and language: "" keys that violate the schema.

Changes:

  • Add omitempty to ServiceConfig.RelativePath (project) and ServiceConfig.Language (language) YAML tags so empty values are not written.
  • Add a regression test ensuring a code-less service host serializes without project: / language: keys.
  • Add a changelog entry under Bugs Fixed documenting the schema-validation fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
cli/azd/pkg/project/service_config.go Updates YAML tags so empty project/language fields are omitted during save, avoiding invalid output for code-less hosts.
cli/azd/pkg/project/project_test.go Adds a test that saves an azure.ai.project service and asserts project:/language: are not emitted.
cli/azd/CHANGELOG.md Documents the bug fix in the Unreleased “Bugs Fixed” section.

@huimiu

huimiu commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

Superseded: moved this change into #8917 (branch hui/fix-foundry-project-name).

@huimiu huimiu closed this Jul 1, 2026
@huimiu huimiu deleted the hui/didactic-guacamole branch July 1, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants