Skip to content

Add JSON-serializable output models for all Apple APIs #152

@rmarinho

Description

@rmarinho

Summary

Define structured, JSON-serializable result types for all Apple environment and simulator management APIs. This supports the --json global option from the CLI spec.

Requirements

Every API should return a typed result that can be serialized to JSON. The output contract should include:

Standard envelope

All JSON output follows a consistent structure:

{ "type": "result", "command": "apple.check", "data": { ... } }
{ "type": "progress", "message": "Downloading iOS 18.2 runtime...", "percent": 45 }
{ "type": "error", "code": "XCODE_NOT_FOUND", "message": "..." }

Model types needed

  • XcodeInfo — version, path, build number, bundled SDKs, isSelected
  • SimulatorInfo — name, UDID, state, runtime, deviceType
  • RuntimeInfo — platform, version, build, identifier, size, source
  • EnvironmentCheckResult — xcode, clt, runtimes, platforms, overall status
  • ProgressReport — message, percent, step
  • ErrorResult — code, message, details

Design Notes

  • Use System.Text.Json source generators for AOT-friendly serialization
  • Follow the naming conventions from the CLI spec (camelCase JSON properties)
  • These models are the contract between the library and the CLI — keep them stable
  • Consider placing in a separate namespace (e.g., Xamarin.MacDev.Models) for clean separation

Reference

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