Skip to content

How to deal with multiple methods that share same path? #362

Answered by ecyrbe
patryk-smc asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

Only way at the moment is to make the path distinguishable or make the returned value an union of the possible results.
Indeed, internaly the path is the only way to dinstinguish which api endpoint to make and which validation to execute.

If you want to do path distinguishable and not use response unions, you can try adding a dummy query parameter.
Indeed usually APIs don't reject unused query parameters :

import { Zodios } from "@zodios/core";
import { z } from "zod";
import { UserSchema,  ArticleSchema} from "./schema";


export const atlasDataClient = new Zodios(
  "https://us-east-1.aws.data.mongodb-api.com/app/data-12345/endpoint",
  [   {
      method: "post",
      path: "/d…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@ecyrbe
Comment options

@patryk-smc
Comment options

Answer selected by patryk-smc
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants