2 * Copyright (c) 2023 PANTHEON.tech s.r.o and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.restconf.openapi.model;
10 import com.fasterxml.jackson.annotation.JsonInclude;
11 import com.fasterxml.jackson.databind.node.ArrayNode;
12 import com.fasterxml.jackson.databind.node.ObjectNode;
13 import java.util.List;
15 @JsonInclude(JsonInclude.Include.NON_NULL)
16 public record Operation(boolean deprecated, List<String> tags, List<Parameter> parameters, ArrayNode security,
17 ArrayNode servers, ObjectNode callbacks, ObjectNode externalDocs, ObjectNode requestBody,
18 ObjectNode responses, String description, String operationId, String summary) {
20 private Operation(final Builder builder) {
21 this(builder.deprecated, builder.tags, builder.parameters, builder.security, builder.servers, builder.callbacks,
22 builder.externalDocs, builder.requestBody, builder.responses, builder.description, builder.operationId,
26 @SuppressWarnings("checkstyle:hiddenField")
27 public static class Builder {
28 private boolean deprecated;
29 private List<String> tags;
30 private List<Parameter> parameters;
31 private ArrayNode security;
32 private ArrayNode servers;
33 private ObjectNode callbacks;
34 private ObjectNode externalDocs;
35 private ObjectNode requestBody;
36 private ObjectNode responses;
37 private String description;
38 private String operationId;
39 private String summary;
41 public Builder deprecated(final boolean deprecated) {
42 this.deprecated = deprecated;
46 public Builder tags(final List<String> tags) {
51 public Builder parameters(final List<Parameter> parameters) {
52 this.parameters = parameters;
56 public Builder security(final ArrayNode security) {
57 this.security = security;
61 public Builder servers(final ArrayNode servers) {
62 this.servers = servers;
66 public Builder callbacks(final ObjectNode callbacks) {
67 this.callbacks = callbacks;
71 public Builder externalDocs(final ObjectNode externalDocs) {
72 this.externalDocs = externalDocs;
76 public Builder requestBody(final ObjectNode requestBody) {
77 this.requestBody = requestBody;
81 public Builder responses(final ObjectNode responses) {
82 this.responses = responses;
86 public Builder description(final String description) {
87 this.description = description;
91 public Builder operationId(final String operationId) {
92 this.operationId = operationId;
96 public Builder summary(final String summary) {
97 this.summary = summary;
101 public Operation build() {
102 return new Operation(this);