@@ -30,10 +30,10 @@ instance Subtree Responses where
30 -- it. So, the logic is swapped.
30 -- it. So, the logic is swapped.
31 checkCompatibility env (ProdCons p c) = do
31 checkCompatibility env (ProdCons p c) = do
32 let defs = getH @(ProdCons (Definitions Response)) env
32 let defs = getH @(ProdCons (Definitions Response)) env
33− for_ (IOHM.toList $ _responsesResponses p) $ \ (prodStatus, prodRef) ->
33+ for_ (IOHM.toList $ _responsesResponses c) $ \(prodStatus, consRef) ->
34− case IOHM.lookup prodStatus $ _responsesResponses c of
34+ case IOHM.lookup prodStatus $ _responsesResponses p of
35− Nothing -> issueAt consumer $ ResponseCodeNotFound prodStatus
35+ Nothing -> issueAt producer $ ResponseCodeNotFound prodStatus
36− Just consRef -> do
36+ Just prodRef -> do
37 let tracedRefs = dereference <$> defs <*> ProdCons prodRef consRef
37 let tracedRefs = dereference <$> defs <*> ProdCons prodRef consRef
38 localStep (ResponseCodeStep prodStatus)
38 localStep (ResponseCodeStep prodStatus)
39 $ checkProdCons env tracedRefs
39 $ checkProdCons env tracedRefs
@@ -56,16 +56,18 @@ instance Subtree Response where
56 checkHeaders
56 checkHeaders
59− -- Each response type expected by producer must be in the consumer (logic
59+ -- Each response type, generated by the consumer must be parseable by the
60− -- is swapped)
60+ -- producer
61 checkMediaTypes = do
61 checkMediaTypes = do
62− for_ (IOHM.toList $ _responseContent p) $ \ (mediaType, prodMediaObject) ->
62+ for_ (IOHM.toList $ _responseContent c) $ \ (mediaType, consMediaObject) ->
63− case IOHM.lookup mediaType $ _responseContent c of
63+ case IOHM.lookup mediaType $ _responseContent p of
64− Nothing -> issueAt consumer $ ResponseMediaTypeMissing mediaType
64+ Nothing -> issueAt producer $ ResponseMediaTypeMissing mediaType
65− Just consMediaObject -> localStep (ResponseMediaObject mediaType)
65+ Just prodMediaObject -> localStep (ResponseMediaObject mediaType)
66 $ swapRoles
66 $ swapRoles
67 $ checkCompatibility @MediaTypeObject (mediaType `HCons` swapProdCons schemaRefs `HCons` HNil)
67 $ checkCompatibility @MediaTypeObject (mediaType `HCons` swapProdCons schemaRefs `HCons` HNil)
68 $ ProdCons consMediaObject prodMediaObject
68 $ ProdCons consMediaObject prodMediaObject
69+ -- Each header expected by the producer must be provided by the
70+ -- consumer. Assume, that extra consumer headers are ignored.
69 checkHeaders = do
71 checkHeaders = do
70 for_ (IOHM.toList $ _responseHeaders p) $ \ (hname, prodRef) ->
72 for_ (IOHM.toList $ _responseHeaders p) $ \ (hname, prodRef) ->
71 case IOHM.lookup hname $ _responseHeaders c of
73 case IOHM.lookup hname $ _responseHeaders c of