GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • AIPs
  • Browse AIPs
  • News
  • FAQ
  • Contributing
  • API Linter
  • View on GitHub
  • Google Cloud Platform
  • Auth
  • Client libraries
  • Workspace
  • Actions on Google
  • 1 AIP Purpose and Guidelines
  • 2 AIP Numbering

This view

  • Original page
  • New address

GeezerVison is showing google.aip.dev — AIP-163: Change validation

Change validation
Number163
Permalinkgoogle.aip.dev/163
StateApproved
Created2019-12-16
Updated2019-12-16
Contents
  • Guidance
    • Declarative-friendly resources
  • Changelog
  • File Bug
  • View source
  • Edit this page

AIP-163

Change validation

Occasionally, a user wants to validate an intended change to see what the result will be before actually making the change. For example, a request to provision new servers in a fleet will have an impact on the overall fleet size and cost, and could potentially have unexpected downstream effects.

Guidance

APIs may provide an option to validate, but not actually execute, a request, and provide the same response (status code, headers, and response body) that it would have provided if the request was actually executed.

To provide this option, the method should include a bool validate_only field in the request message:

message ReviewBookRequest {
  string name = 1 [(google.api.resource_reference) = {
    type: "library.googleapis.com/Book"
  }];
  int32 rating = 2;
  string comment = 3;

  // If set, validate the request and preview the review, but do not actually
  // post it.
  bool validate_only = 4;
}

The API must perform permission checks and any other validation that would be performed on a "live" request; a request using validate_only must fail if it determines that the actual request would fail.

Note: It may occasionally be infeasible to provide the full output. For example, if creating a resource would create an auto-generated ID, it does not make sense to do this on validation. APIs should omit such fields on validation requests in this situation.

Declarative-friendly resources

A resource that is declarative-friendly (AIP-128) must include a validate_only field on methods that mutate the resource.

Changelog

  • 2020-10-06: Added declarative-friendly resource requirement.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.