(t *testing.T)
| 117 | } |
| 118 | |
| 119 | func TestHTTPEndpointValidation(t *testing.T) { |
| 120 | cases := map[string]struct { |
| 121 | DSL func() |
| 122 | Error string |
| 123 | }{ |
| 124 | "endpoint-body-as-payload-prop": { |
| 125 | DSL: testdata.EndpointBodyAsPayloadProp, |
| 126 | }, |
| 127 | "endpoint-body-as-missed-payload-prop": { |
| 128 | DSL: testdata.EndpointBodyAsMissedPayloadProp, |
| 129 | Error: `Request type does not have an attribute named "name" in service "Service" HTTP endpoint "Method"`, |
| 130 | }, |
| 131 | "endpoint-body-extend-payload": { |
| 132 | DSL: testdata.EndpointBodyExtendPayload, |
| 133 | }, |
| 134 | "endpoint-body-as-user-type": { |
| 135 | DSL: testdata.EndpointBodyAsUserType, |
| 136 | }, |
| 137 | "endpoint-missing-token": { |
| 138 | DSL: testdata.EndpointMissingToken, |
| 139 | Error: `service "Service" method "Method": payload of method "Method" of service "Service" does not define a JWT attribute, use Token to define one`, |
| 140 | }, |
| 141 | "endpoint-missing-token-payload": { |
| 142 | DSL: testdata.EndpointMissingTokenPayload, |
| 143 | Error: `service "Service" method "Method": payload of method "Method" of service "Service" does not define a JWT attribute, use Token to define one`, |
| 144 | }, |
| 145 | "endpoint-missing-token-extend": { |
| 146 | DSL: testdata.EndpointExtendToken, |
| 147 | }, |
| 148 | "endpoint-has-parent": { |
| 149 | DSL: testdata.EndpointHasParent, |
| 150 | }, |
| 151 | "endpoint-has-parent-and-other": { |
| 152 | DSL: testdata.EndpointHasParentAndOther, |
| 153 | }, |
| 154 | "endpoint-has-skip-request-encode-and-payload-streaming": { |
| 155 | DSL: testdata.EndpointHasSkipRequestEncodeAndPayloadStreaming, |
| 156 | Error: `service "Service" HTTP endpoint "Method": Endpoint cannot use SkipRequestBodyEncodeDecode when method defines a StreamingPayload.`, |
| 157 | }, |
| 158 | "endpoint-has-skip-request-encode-and-result-streaming": { |
| 159 | DSL: testdata.EndpointHasSkipRequestEncodeAndResultStreaming, |
| 160 | Error: `service "Service" HTTP endpoint "Method": Endpoint cannot use SkipRequestBodyEncodeDecode when method defines a StreamingResult. Use SkipResponseBodyEncodeDecode instead.`, |
| 161 | }, |
| 162 | "endpoint-has-skip-response-encode-and-payload-streaming": { |
| 163 | DSL: testdata.EndpointHasSkipResponseEncodeAndPayloadStreaming, |
| 164 | Error: `service "Service" HTTP endpoint "Method": Endpoint cannot use SkipResponseBodyEncodeDecode when method defines a StreamingPayload. Use SkipRequestBodyEncodeDecode instead.`, |
| 165 | }, |
| 166 | "endpoint-has-skip-response-encode-and-result-streaming": { |
| 167 | DSL: testdata.EndpointHasSkipResponseEncodeAndResultStreaming, |
| 168 | Error: `service "Service" HTTP endpoint "Method": Endpoint cannot use SkipResponseBodyEncodeDecode when method defines a StreamingResult. |
| 169 | service "Service" HTTP endpoint "Method": HTTP endpoint response body must be empty when using SkipResponseBodyEncodeDecode. Make sure to define headers and cookies as needed.`, |
| 170 | }, |
| 171 | "endpoint-has-skip-encode-and-grpc": { |
| 172 | DSL: testdata.EndpointHasSkipEncodeAndGRPC, |
| 173 | Error: `service "Service" HTTP endpoint "Method": Endpoint cannot use SkipRequestBodyEncodeDecode and define a gRPC transport.`, |
| 174 | }, |
| 175 | "endpoint-payload-missing-required": { |
| 176 | DSL: testdata.EndpointPayloadMissingRequired, |
nothing calls this directly
no test coverage detected