async def METHOD_NAME(
    app: FastAPI,
    specs: dict[str, Any],
    *,
    service_key: ServiceKey,
    service_version: ServiceVersion,
) -> dict[str, Any]:
    assert specs  # nosec
    resolver = SpecsSubstitutionsResolver(specs, upgrade=False)
    repo = get_repository(app, ServicesEnvironmentsRepository)
    if any(repo.is_vendor_secret_identifier(idr) for idr in resolver.get_identifiers()):
        # checks before to avoid unnecesary calls to pg
        vendor_secrets = await repo.get_vendor_secrets(
            service_key=service_key, service_version=service_version
        )
        # resolve substitutions
        resolver.set_substitutions(environs=vendor_secrets)
        new_specs: dict[str, Any] = resolver.run()
        return new_specs
    return deepcopy(specs)