{"record":{"id":"019044aaf013e1e2","repo":"alibaba/spring-ai-alibaba","slug":"notsupportoperation-only-support-post-get","errorCode":null,"errorMessage":"NotSupportOperation Only Support post/get","messagePattern":"NotSupportOperation Only Support post/get","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/utils/api/OpenApiUtils.java","lineNumber":280,"sourceCode":"\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tyamlParamInfo.setType(firstLetterToUpperCase(nameSchemaType));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tinputYamlParamList.add(yamlParamInfo);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (pathItem.getGet() != null) {\n\t\t\t\t\toperation = pathItem.getGet();\n\t\t\t\t\ttoolConfig.setRequestMethod(\"Get\");\n\t\t\t\t\tif (operation.getParameters() != null) {\n\t\t\t\t\t\tparamToYamlParam(operation.getParameters(), inputYamlParamList);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new RuntimeException(\"NotSupportOperation Only Support post/get\");\n\t\t\t\t}\n\n\t\t\t\ttoolConfig.setInputParams(inputYamlParamList);\n\n\t\t\t\t// 添加输出\n\t\t\t\tApiResponses apiResponses = operation.getResponses();\n\t\t\t\tApiResponse apiResponse = apiResponses.get(\"200\");\n\t\t\t\tif (apiResponse != null && apiResponse.getContent() != null) {\n\t\t\t\t\tMediaType mediaType = apiResponse.getContent()\n\t\t\t\t\t\t.get(org.springframework.http.MediaType.APPLICATION_JSON_VALUE);\n\t\t\t\t\tif (mediaType == null) {\n\t\t\t\t\t\tmediaType = apiResponse.getContent()\n\t\t\t\t\t\t\t.get(org.springframework.http.MediaType.APPLICATION_FORM_URLENCODED_VALUE);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (mediaType == null) {\n\t\t\t\t\t\tmediaType = apiResponse.getContent().get(\"*/*\");\n\t\t\t\t\t}","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/utils/api/OpenApiUtils.java#L262-L298","documentation":"parseSchemaToForm() only imports operations defined as post or get; any other OpenAPI operation type (put, delete, patch, head, options) throws RuntimeException(\"NotSupportOperation Only Support post/get\") because the generated tool config models only GET/POST request methods.","triggerScenarios":"Importing an OpenAPI path containing a put/delete/patch operation — e.g. RESTful CRUD specs with DELETE /items/{id} or PATCH endpoints.","commonSituations":"Importing full CRUD REST specs; APIs using PATCH for partial updates; auto-generated specs from Spring/other frameworks exposing all verbs.","solutions":["Remove or exclude put/delete/patch operations from the spec before import","Refactor the endpoint to use POST (with an action field) or GET where semantically acceptable","Extend OpenApiUtils to map additional verbs if your use case requires them"],"exampleFix":"// before\npaths:\n  /items/{id}:\n    delete: {...}\n// after\npaths:\n  /items/delete:\n    post:\n      requestBody:\n        content:\n          application/json:\n            schema:\n              type: object\n              properties: {id: {type: string}}","handlingStrategy":"validation","validationCode":"boolean supported = paths.values().stream()\n    .flatMap(p -> p.readOperations().stream())\n    .allMatch(op -> op.getOperationId() == null);\n// simpler: check path item keys before import\nSet<String> verbs = pathItem.readOperationsMap().keySet().stream()\n    .map(Enum::name).map(String::toLowerCase)\n    .collect(Collectors.toSet());\nif (!verbs.stream().allMatch(v -> v.equals(\"get\") || v.equals(\"post\"))) {\n    throw new IllegalArgumentException(\"Only get/post operations are importable\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    OpenApiUtils.parseSchemaToForm(spec);\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"NotSupportOperation\")) {\n        // strip or rewrite put/delete/patch operations, then retry\n    }\n}","preventionTips":["Filter spec paths to get/post before import","Expose destructive ops as POST endpoints for tool use","Record which endpoints were skipped during import"],"tags":["openapi","http","import","java"],"backgroundTag":"unsupported-operation","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}