Skip to content

Commit b1d08c9

Browse files
fmt
1 parent b76245d commit b1d08c9

File tree

16 files changed

+1722
-1733
lines changed

16 files changed

+1722
-1733
lines changed

databricks-sdk-java/src/main/java/com/databricks/sdk/core/error/ApiErrorBody.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package com.databricks.sdk.core.error;
22

3+
import com.databricks.sdk.core.error.details.ErrorDetails;
34
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
45
import com.fasterxml.jackson.annotation.JsonProperty;
5-
import com.databricks.sdk.core.error.details.ErrorDetails;
6-
import java.util.List;
76
import java.util.Arrays;
87
import java.util.Collections;
8+
import java.util.List;
99

1010
/**
1111
* The union of all JSON error responses from the Databricks APIs, not including HTML responses.
@@ -104,6 +104,11 @@ private static List<ErrorDetail> fromDetails(ErrorDetails details) {
104104
if (!details.errorInfo().isPresent()) {
105105
return Collections.emptyList();
106106
}
107-
return Arrays.asList(new ErrorDetail("type.googleapis.com/google.rpc.ErrorInfo", details.errorInfo().get().reason(), details.errorInfo().get().domain(), details.errorInfo().get().metadata()));
107+
return Arrays.asList(
108+
new ErrorDetail(
109+
"type.googleapis.com/google.rpc.ErrorInfo",
110+
details.errorInfo().get().reason(),
111+
details.errorInfo().get().domain(),
112+
details.errorInfo().get().metadata()));
108113
}
109114
}
Lines changed: 145 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -1,186 +1,182 @@
11
package com.databricks.sdk.core.error.details;
22

3-
import com.fasterxml.jackson.annotation.JsonProperty;
43
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
55
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
66
import com.google.auto.value.AutoValue;
77
import java.util.List;
88

99
/**
10-
* BadRequest describes violations in a client request. This error type focuses
11-
* on the syntactic aspects of the request.
12-
*
13-
* <p>BadRequest errors occur when the request format, structure, or content
14-
* does not meet the service's requirements. This is different from business
15-
* logic errors or system failures - it specifically indicates that the client
16-
* sent a malformed or invalid request.
17-
*
10+
* BadRequest describes violations in a client request. This error type focuses on the syntactic
11+
* aspects of the request.
12+
*
13+
* <p>BadRequest errors occur when the request format, structure, or content does not meet the
14+
* service's requirements. This is different from business logic errors or system failures - it
15+
* specifically indicates that the client sent a malformed or invalid request.
16+
*
1817
* <p>Examples of bad request violations might include:
18+
*
1919
* <ul>
20-
* <li>Missing required fields</li>
21-
* <li>Invalid field values (wrong type, format, or range)</li>
22-
* <li>Malformed JSON or XML</li>
23-
* <li>Unsupported field combinations</li>
24-
* <li>Invalid enum values</li>
25-
* <li>Field length or size violations</li>
20+
* <li>Missing required fields
21+
* <li>Invalid field values (wrong type, format, or range)
22+
* <li>Malformed JSON or XML
23+
* <li>Unsupported field combinations
24+
* <li>Invalid enum values
25+
* <li>Field length or size violations
2626
* </ul>
27-
*
27+
*
2828
* <p>This information helps clients:
29+
*
2930
* <ul>
30-
* <li>Identify what's wrong with their request</li>
31-
* <li>Fix the request format before retrying</li>
32-
* <li>Understand the service's input requirements</li>
33-
* <li>Implement proper input validation</li>
31+
* <li>Identify what's wrong with their request
32+
* <li>Fix the request format before retrying
33+
* <li>Understand the service's input requirements
34+
* <li>Implement proper input validation
3435
* </ul>
3536
*/
3637
@AutoValue
3738
@JsonDeserialize(builder = AutoValue_BadRequest.Builder.class)
3839
@JsonIgnoreProperties(ignoreUnknown = true)
3940
public abstract class BadRequest {
4041

42+
/**
43+
* Describes all field violations in the request.
44+
*
45+
* <p>This list contains details about each specific field or aspect of the request that violated
46+
* the service's requirements. Multiple violations can occur if the request has multiple problems.
47+
*
48+
* @return the list of field violations
49+
*/
50+
@JsonProperty("field_violations")
51+
public abstract List<BadRequestFieldViolation> fieldViolations();
52+
53+
/**
54+
* Creates a new builder for constructing BadRequest instances.
55+
*
56+
* @return a new builder instance
57+
*/
58+
public static Builder builder() {
59+
return new AutoValue_BadRequest.Builder();
60+
}
61+
62+
/** Builder for constructing BadRequest instances. */
63+
@AutoValue.Builder
64+
@JsonIgnoreProperties(ignoreUnknown = true)
65+
public abstract static class Builder {
66+
4167
/**
42-
* Describes all field violations in the request.
43-
*
44-
* <p>This list contains details about each specific field or aspect of
45-
* the request that violated the service's requirements. Multiple violations
46-
* can occur if the request has multiple problems.
47-
*
48-
* @return the list of field violations
68+
* Sets the field violations.
69+
*
70+
* @param fieldViolations the list of field violations
71+
* @return this builder for method chaining
4972
*/
5073
@JsonProperty("field_violations")
51-
public abstract List<BadRequestFieldViolation> fieldViolations();
74+
public abstract Builder fieldViolations(List<BadRequestFieldViolation> fieldViolations);
5275

5376
/**
54-
* Creates a new builder for constructing BadRequest instances.
55-
*
56-
* @return a new builder instance
77+
* Builds the BadRequest instance.
78+
*
79+
* @return a new BadRequest instance
5780
*/
58-
public static Builder builder() {
59-
return new AutoValue_BadRequest.Builder();
60-
}
81+
public abstract BadRequest build();
82+
}
83+
84+
/**
85+
* BadRequestFieldViolation describes a specific field violation in a request.
86+
*
87+
* <p>Each violation provides details about what specific field or aspect of the request was
88+
* invalid and how the client can fix it.
89+
*/
90+
@AutoValue
91+
@JsonDeserialize(builder = AutoValue_BadRequest_BadRequestFieldViolation.Builder.class)
92+
@JsonIgnoreProperties(ignoreUnknown = true)
93+
public abstract static class BadRequestFieldViolation {
6194

6295
/**
63-
* Builder for constructing BadRequest instances.
96+
* A path leading to a field in the request body.
97+
*
98+
* <p>This field identifies the specific location of the violation within the request structure.
99+
* The path format depends on the request format but typically follows a hierarchical structure.
100+
*
101+
* <p>Examples of field paths:
102+
*
103+
* <ul>
104+
* <li>"name" - top-level field
105+
* <li>"user.email" - nested field
106+
* <li>"items[0].id" - array element field
107+
* <li>"metadata.api_key" - deeply nested field
108+
* <li>"settings.notifications.enabled" - multi-level nested field
109+
* </ul>
110+
*
111+
* <p>This path helps clients quickly locate and fix the problematic field in their request.
112+
*
113+
* @return the path to the violating field
64114
*/
65-
@AutoValue.Builder
66-
@JsonIgnoreProperties(ignoreUnknown = true)
67-
public abstract static class Builder {
68-
69-
/**
70-
* Sets the field violations.
71-
*
72-
* @param fieldViolations the list of field violations
73-
* @return this builder for method chaining
74-
*/
75-
@JsonProperty("field_violations")
76-
public abstract Builder fieldViolations(List<BadRequestFieldViolation> fieldViolations);
77-
78-
/**
79-
* Builds the BadRequest instance.
80-
*
81-
* @return a new BadRequest instance
82-
*/
83-
public abstract BadRequest build();
84-
}
115+
@JsonProperty("field")
116+
public abstract String field();
85117

86118
/**
87-
* BadRequestFieldViolation describes a specific field violation in a request.
88-
*
89-
* <p>Each violation provides details about what specific field or aspect
90-
* of the request was invalid and how the client can fix it.
119+
* A description of why the request element is bad.
120+
*
121+
* <p>This field provides a human-readable explanation of what's wrong with the field and how to
122+
* fix it. The description should be clear enough for developers to understand and resolve the
123+
* issue.
124+
*
125+
* <p>Examples of field violation descriptions:
126+
*
127+
* <ul>
128+
* <li>"Field is required and cannot be empty"
129+
* <li>"Value must be a positive integer"
130+
* <li>"Invalid email format"
131+
* <li>"String length must be between 1 and 100 characters"
132+
* <li>"Unsupported enum value. Must be one of: [A, B, C]"
133+
* <li>"Field cannot contain special characters"
134+
* <li>"Date must be in ISO 8601 format (YYYY-MM-DD)"
135+
* </ul>
136+
*
137+
* @return description of why the field is invalid
91138
*/
92-
@AutoValue
93-
@JsonDeserialize(builder = AutoValue_BadRequest_BadRequestFieldViolation.Builder.class)
94-
@JsonIgnoreProperties(ignoreUnknown = true)
95-
public abstract static class BadRequestFieldViolation {
139+
@JsonProperty("description")
140+
public abstract String description();
96141

97-
/**
98-
* A path leading to a field in the request body.
99-
*
100-
* <p>This field identifies the specific location of the violation
101-
* within the request structure. The path format depends on the request
102-
* format but typically follows a hierarchical structure.
103-
*
104-
* <p>Examples of field paths:
105-
* <ul>
106-
* <li>"name" - top-level field</li>
107-
* <li>"user.email" - nested field</li>
108-
* <li>"items[0].id" - array element field</li>
109-
* <li>"metadata.api_key" - deeply nested field</li>
110-
* <li>"settings.notifications.enabled" - multi-level nested field</li>
111-
* </ul>
112-
*
113-
* <p>This path helps clients quickly locate and fix the problematic
114-
* field in their request.
115-
*
116-
* @return the path to the violating field
117-
*/
118-
@JsonProperty("field")
119-
public abstract String field();
142+
/**
143+
* Creates a new builder for constructing BadRequestFieldViolation instances.
144+
*
145+
* @return a new builder instance
146+
*/
147+
public static Builder builder() {
148+
return new AutoValue_BadRequest_BadRequestFieldViolation.Builder();
149+
}
150+
151+
/** Builder for constructing BadRequestFieldViolation instances. */
152+
@AutoValue.Builder
153+
@JsonIgnoreProperties(ignoreUnknown = true)
154+
public abstract static class Builder {
120155

121-
/**
122-
* A description of why the request element is bad.
123-
*
124-
* <p>This field provides a human-readable explanation of what's wrong
125-
* with the field and how to fix it. The description should be clear
126-
* enough for developers to understand and resolve the issue.
127-
*
128-
* <p>Examples of field violation descriptions:
129-
* <ul>
130-
* <li>"Field is required and cannot be empty"</li>
131-
* <li>"Value must be a positive integer"</li>
132-
* <li>"Invalid email format"</li>
133-
* <li>"String length must be between 1 and 100 characters"</li>
134-
* <li>"Unsupported enum value. Must be one of: [A, B, C]"</li>
135-
* <li>"Field cannot contain special characters"</li>
136-
* <li>"Date must be in ISO 8601 format (YYYY-MM-DD)"</li>
137-
* </ul>
138-
*
139-
* @return description of why the field is invalid
140-
*/
141-
@JsonProperty("description")
142-
public abstract String description();
156+
/**
157+
* Sets the field path.
158+
*
159+
* @param field the path to the violating field
160+
* @return this builder for method chaining
161+
*/
162+
@JsonProperty("field")
163+
public abstract Builder field(String field);
143164

144-
/**
145-
* Creates a new builder for constructing BadRequestFieldViolation instances.
146-
*
147-
* @return a new builder instance
148-
*/
149-
public static Builder builder() {
150-
return new AutoValue_BadRequest_BadRequestFieldViolation.Builder();
151-
}
165+
/**
166+
* Sets the violation description.
167+
*
168+
* @param description description of why the field is invalid
169+
* @return this builder for method chaining
170+
*/
171+
@JsonProperty("description")
172+
public abstract Builder description(String description);
152173

153-
/**
154-
* Builder for constructing BadRequestFieldViolation instances.
155-
*/
156-
@AutoValue.Builder
157-
@JsonIgnoreProperties(ignoreUnknown = true)
158-
public abstract static class Builder {
159-
160-
/**
161-
* Sets the field path.
162-
*
163-
* @param field the path to the violating field
164-
* @return this builder for method chaining
165-
*/
166-
@JsonProperty("field")
167-
public abstract Builder field(String field);
168-
169-
/**
170-
* Sets the violation description.
171-
*
172-
* @param description description of why the field is invalid
173-
* @return this builder for method chaining
174-
*/
175-
@JsonProperty("description")
176-
public abstract Builder description(String description);
177-
178-
/**
179-
* Builds the BadRequestFieldViolation instance.
180-
*
181-
* @return a new BadRequestFieldViolation instance
182-
*/
183-
public abstract BadRequestFieldViolation build();
184-
}
174+
/**
175+
* Builds the BadRequestFieldViolation instance.
176+
*
177+
* @return a new BadRequestFieldViolation instance
178+
*/
179+
public abstract BadRequestFieldViolation build();
185180
}
186-
}
181+
}
182+
}

0 commit comments

Comments
 (0)