Reference an operation to its path (or vice versa) #1880
              
                Unanswered
              
          
                  
                    
                      bennettdams
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 1 comment 2 replies
-
| This is possible with Operation IDs today. There’s one  These are in all the examples and we have tests to catch this; is there an error in your schema anywhere? | 
Beta Was this translation helpful? Give feedback.
                  
                    2 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Hey!
I generate
pathsandoperations, but both of them cannot be referenced to each other.The path uses the operations's type, but there is no way in TypeScript to know that this path is for this operation.
What I was trying to do:
Create a function for that operation. It should take the request body as a parameter. But I cannot allow both type-safety for a) the path and b) the operations' request body together, because the types don't know of each other.
For example:
The path
some-operationusessomeOperationto describepost, but one cannot reference them afterwards.Is there something I am missing? Maybe a CLI flag? I even tried to use
operationIdin my schema, but that does not help.This could be fixed by having a 1-to-1-mapping of each path and its operation. Either via a field in each
pathsentry or via a new type that just maps them together.Beta Was this translation helpful? Give feedback.
All reactions