git.iko.soy/typeable/compaREST
on master help sign in
Added non-breaking changes to reports (#82)

* bumped resolver * Added non-breaking changes to report * Removed dead file * Added backward issue descriptions * Issue description reversing * Changed wording slightly

commit2440f23829a1180e293a08180003f1ffe6104fbe authoriko <ilyakooo0@gmail.com> dateMon 21 Jun 2021, 20:52 (5 years ago) parent695c8fb
90 files changed+872−287
app/Main.hs+19−20 openapi-diff.cabal+3−1 src/OpenAPI/Checker/Behavior.hs+19−1 src/OpenAPI/Checker/Report.hs+102−43 src/OpenAPI/Checker/Run.hs+30 src/OpenAPI/Checker/Subtree/Deriving.hs−6 src/OpenAPI/Checker/Validate/Header.hs+5−3 src/OpenAPI/Checker/Validate/Link.hs+1−1 src/OpenAPI/Checker/Validate/MediaTypeObject.hs+13−7 src/OpenAPI/Checker/Validate/OAuth2Flows.hs+28−20 src/OpenAPI/Checker/Validate/Operation.hs+7−4 src/OpenAPI/Checker/Validate/Param.hs+9−7 src/OpenAPI/Checker/Validate/RequestBody.hs+6−2 src/OpenAPI/Checker/Validate/Responses.hs+6−2 src/OpenAPI/Checker/Validate/Schema.hs+53−33 src/OpenAPI/Checker/Validate/Server.hs+9−4 stack.yaml+1−1 stack.yaml.lock+4−4 test/Spec.hs+1−1 test/Spec/Golden/TraceTree.hs+2−17 test/golden/common/enum-anyof/report.md+5−1 test/golden/common/enum-anyof/trace-tree.yaml+2−1 test/golden/common/id/report.md+5−1 test/golden/common/id/trace-tree.yaml+2−1 test/golden/common/json/recursive/report.md+5−1 test/golden/common/json/recursive/trace-tree.yaml+2−1 test/golden/common/maximum-lowered/report.md+14−4 test/golden/common/maximum-lowered/trace-tree.yaml+9−1 test/golden/common/pathItem/operation/parameters/allowEmptyValue/reset/report.md+4−4 test/golden/common/pathItem/operation/parameters/allowEmptyValue/reset/trace-tree.yaml+2−1 test/golden/common/pathItem/operation/parameters/allowEmptyValue/set/report.md+13−1 test/golden/common/pathItem/operation/parameters/allowEmptyValue/set/trace-tree.yaml+5−1 test/golden/common/pathItem/operation/parameters/change/report.md+15−3 test/golden/common/pathItem/operation/parameters/change/trace-tree.yaml+7−1 test/golden/common/pathItem/operation/parameters/required/false/add/report.md+5−1 test/golden/common/pathItem/operation/parameters/required/false/add/trace-tree.yaml+2−1 test/golden/common/pathItem/operation/parameters/required/false/del/report.md+5−1 test/golden/common/pathItem/operation/parameters/required/false/del/trace-tree.yaml+2−1 test/golden/common/pathItem/operation/parameters/required/reset/report.md+13−1 test/golden/common/pathItem/operation/parameters/required/reset/trace-tree.yaml+5−1 test/golden/common/pathItem/operation/parameters/required/set/report.md+3−3 test/golden/common/pathItem/operation/parameters/required/set/trace-tree.yaml+2−1 test/golden/common/pathItem/operation/parameters/required/true/add/report.md+3−3 test/golden/common/pathItem/operation/parameters/required/true/add/trace-tree.yaml+2−1 test/golden/common/pathItem/operation/parameters/required/true/del/report.md+11−1 test/golden/common/pathItem/operation/parameters/required/true/del/trace-tree.yaml+4−1 test/golden/common/pathItem/operation/requestBody/mediaTypeObject/add/report.md+13−1 test/golden/common/pathItem/operation/requestBody/mediaTypeObject/add/trace-tree.yaml+5−1 test/golden/common/pathItem/operation/requestBody/mediaTypeObject/change/report.md+14−4 test/golden/common/pathItem/operation/requestBody/mediaTypeObject/change/trace-tree.yaml+8−1 test/golden/common/pathItem/operation/requestBody/mediaTypeObject/del/report.md+3−3 test/golden/common/pathItem/operation/requestBody/mediaTypeObject/del/trace-tree.yaml+2−1 test/golden/common/pathItem/operation/requestBody/required/reset/report.md+13−1 test/golden/common/pathItem/operation/requestBody/required/reset/trace-tree.yaml+5−1 test/golden/common/pathItem/operation/requestBody/required/set/report.md+3−3 test/golden/common/pathItem/operation/requestBody/required/set/trace-tree.yaml+2−1 test/golden/common/pathItem/operation/responses/add/report.md+3−3 test/golden/common/pathItem/operation/responses/add/trace-tree.yaml+2−1 test/golden/common/pathItem/operation/responses/change/headers/mandatory/add/report.md+13−1 test/golden/common/pathItem/operation/responses/change/headers/mandatory/add/trace-tree.yaml+5−1 test/golden/common/pathItem/operation/responses/change/headers/mandatory/del/report.md+4−4 test/golden/common/pathItem/operation/responses/change/headers/mandatory/del/trace-tree.yaml+2−1 test/golden/common/pathItem/operation/responses/change/headers/optional/add/report.md+5−1 test/golden/common/pathItem/operation/responses/change/headers/optional/add/trace-tree.yaml+2−1 test/golden/common/pathItem/operation/responses/change/headers/optional/del/report.md+5−1 test/golden/common/pathItem/operation/responses/change/headers/optional/del/trace-tree.yaml+2−1 test/golden/common/pathItem/operation/responses/change/mediaTypeObject/add/report.md+3−3 test/golden/common/pathItem/operation/responses/change/mediaTypeObject/add/trace-tree.yaml+2−1 test/golden/common/pathItem/operation/responses/change/mediaTypeObject/change/report.md+14−4 test/golden/common/pathItem/operation/responses/change/mediaTypeObject/change/trace-tree.yaml+8−1 test/golden/common/pathItem/operation/responses/change/mediaTypeObject/del/report.md+13−1 test/golden/common/pathItem/operation/responses/change/mediaTypeObject/del/trace-tree.yaml+5−1 test/golden/common/pathItem/operation/responses/del/report.md+11−1 test/golden/common/pathItem/operation/responses/del/trace-tree.yaml+4−1 test/golden/common/property-removed-additional/a.yaml+32 test/golden/common/property-removed-additional/b.yaml+29 test/golden/common/property-removed-additional/report.md+25 test/golden/common/property-removed-additional/trace-tree.yaml+14 test/golden/common/property-removed/report.md+22−6 test/golden/common/property-removed/trace-tree.yaml+12−1 test/golden/common/property-required/report.md+14−4 test/golden/common/property-required/trace-tree.yaml+8−1 test/golden/common/recursive/report.md+19−1 test/golden/common/recursive/trace-tree.yaml+14−1 test/golden/common/security-scheme/report.md+13−3 test/golden/common/security-scheme/trace-tree.yaml+6−1 test/golden/common/servers/report.md+11−3 test/golden/common/servers/trace-tree.yaml+6−1 test/golden/common/unguarded-recursive/report.md+4−4 test/golden/common/unguarded-recursive/trace-tree.yaml+7−1
app/Main.hs+19−20
@@ -5,19 +5,14 @@ import Control.Monad.Except
55import Data.Aeson
66import qualified Data.ByteString.Lazy as BSL
77import Data.Default
8−import Data.HList
98import qualified Data.Text.IO as T
109import qualified Data.Yaml as Yaml
1110import FormatHeuristic
12−import OpenAPI.Checker.Behavior
1311import OpenAPI.Checker.Options
14−import OpenAPI.Checker.Paths
15−import OpenAPI.Checker.PathsPrefixTree
16−import OpenAPI.Checker.Report
17−import OpenAPI.Checker.Subtree
12+import OpenAPI.Checker.Run
1813import System.Exit
1914import System.IO
20−import Text.Pandoc
15+import Text.Pandoc hiding (report)
2116
2217main :: IO ()
2318main = do
@@ -33,23 +28,27 @@ main = do
3328 fail "Exiting"
3429 Right s -> pure s
3530 Right s -> pure s
36− a <- traced (step ClientSchema) <$> parseSchema (clientFile opts)
37− b <- traced (step ServerSchema) <$> parseSchema (serverFile opts)
38− let result = runCompatFormula $ checkCompatibility HNil Root (ProdCons a b)
39− runPandocIO :: PandocIO a -> ExceptT Errors IO a
31+ a <- parseSchema (clientFile opts)
32+ b <- parseSchema (serverFile opts)
33+ let runPandocIO :: PandocIO a -> ExceptT Errors IO a
4034 runPandocIO x = lift (runIO x) >>= either (throwError . DocumentError) pure
4135 options = def {writerExtensions = githubMarkdownExtensions}
42− output :: Either (PathsPrefixTree Behave AnIssue 'APILevel) () -> ExceptT Errors IO ()
43− output = case outputMode opts of
44− StdoutMode -> lift . T.putStrLn <=< runPandocIO . writeMarkdown options . generateReport
36+ write :: Pandoc -> ExceptT Errors IO ()
37+ write = case outputMode opts of
38+ StdoutMode -> lift . T.putStrLn <=< runPandocIO . writeMarkdown options
4539 FileMode f -> case formatFromFilePath f of
4640 Nothing -> \_ -> throwError UnknownOutputFormat
47− Just (TextWriter writer) -> lift . T.writeFile f <=< runPandocIO . writer options . generateReport
48− Just (ByteStringWriter writer) -> lift . BSL.writeFile f <=< runPandocIO . writer options . generateReport
49− either handler pure <=< runExceptT $ output result
50− case result of
51− Right () -> exitSuccess
52− Left _ -> exitWith $ ExitFailure 1
41+ Just (TextWriter writer) -> lift . T.writeFile f <=< runPandocIO . writer options
42+ Just (ByteStringWriter writer) -> lift . BSL.writeFile f <=< runPandocIO . writer options
43+ -- output :: Either (PathsPrefixTree Behave AnIssue 'APILevel) () -> ExceptT Errors IO ()
44+ -- output inp = do
45+ -- undefined
46+ (report, status) = runReport (a, b)
47+ either handler pure <=< runExceptT $ write report
48+ case status of
49+ NoBreakingChanges -> exitSuccess
50+ BreakingChanges -> exitWith $ ExitFailure 1
51+ OnlyUnsupportedChanges -> exitWith $ ExitFailure 2
5352
5453data Errors
5554 = DocumentError PandocError
openapi-diff.cabal+3−1
@@ -35,7 +35,7 @@ common common-options
3535 -Wno-missing-local-signatures
3636 -Wno-unsafe
3737 default-language: Haskell2010
38− build-depends: base >= 4.12.0.0 && < 4.15
38+ build-depends: base >= 4.12.0.0 && < 4.16
3939 , bytestring
4040 , text
4141
@@ -104,6 +104,7 @@ library
104104 , transformers
105105 , mtl
106106 , aeson
107+ , generic-data
107108 hs-source-dirs: src
108109 exposed-modules: Data.HList
109110 , OpenAPI.Checker.Behavior
@@ -134,6 +135,7 @@ library
134135 , OpenAPI.Checker.Report
135136 , Data.OpenUnion.Extra
136137 , OpenAPI.Checker.Report.Jet
138+ , OpenAPI.Checker.Run
137139
138140executable openapi-diff
139141 import: common-options
src/OpenAPI/Checker/Behavior.hs+19−1
@@ -2,6 +2,8 @@ module OpenAPI.Checker.Behavior
22 ( BehaviorLevel (..)
33 , Behavable (..)
44 , Issuable (..)
5+ , Orientation (..)
6+ , toggleOrientation
57 , Behavior
68 , AnIssue (..)
79 )
@@ -43,9 +45,25 @@ type instance AdditionalQuiverConstraints Behave a b = Behavable a b
4345
4446class (Typeable l, Ord (Issue l), Show (Issue l)) => Issuable (l :: BehaviorLevel) where
4547 data Issue l :: Type
46− describeIssue :: Issue l -> Blocks
48+
49+ -- | The same issues can be rendered in multiple places and might
50+ -- require different ways of represnting them to the user.
51+ --
52+ -- In practice each issue requires a maximum of two different representations:
53+ -- based on the context the issue might need to be rendered as "opposite" ('Backward')
54+ -- – for example when rendering non-breaking changes everything should be
55+ -- reversed (a consequence of the way we generate non-breaking changes).
56+ describeIssue :: Orientation -> Issue l -> Blocks
57+
4758 issueIsUnsupported :: Issue l -> Bool
4859
60+data Orientation = Forward | Backward
61+ deriving stock (Eq, Ord)
62+
63+toggleOrientation :: Orientation -> Orientation
64+toggleOrientation Forward = Backward
65+toggleOrientation Backward = Forward
66+
4967-- | A set of interactions having common unifying features
5068type Behavior = Paths Behave 'APILevel
5169
src/OpenAPI/Checker/Report.hs+102−43
@@ -1,15 +1,20 @@
11module OpenAPI.Checker.Report
22 ( generateReport
3+ , ReportInput (..)
4+ , ReportStatus (..)
5+ , Pandoc
36 )
47where
58
69import Control.Monad.Free hiding (unfoldM)
710import Control.Monad.Reader
811import Control.Monad.Writer
12+import Data.Aeson (ToJSON)
913import Data.Either
1014import Data.Foldable
1115import Data.Function
1216import Data.Functor
17+import Data.Functor.Const
1318import Data.List.NonEmpty
1419import qualified Data.List.NonEmpty as NE
1520import qualified Data.Map as M
@@ -22,6 +27,7 @@ import Data.Text (Text)
2227import qualified Data.Text as T
2328import Data.TypeRepMap hiding (empty)
2429import Data.Typeable
30+import Generic.Data
2531import OpenAPI.Checker.Behavior
2632import OpenAPI.Checker.Paths
2733import OpenAPI.Checker.PathsPrefixTree hiding (empty)
@@ -31,27 +37,79 @@ import OpenAPI.Checker.Validate.OpenApi
3137import OpenAPI.Checker.Validate.Schema
3238import Text.Pandoc.Builder
3339
34−generateReport :: Either (P.PathsPrefixTree Behave AnIssue 'APILevel) () -> Pandoc
35−generateReport (Right ()) = doc $ header 1 "No breaking changes found ✨"
36−generateReport (Left errs) = doc $
37− runReportMonad jets $ do
38− let (unsupported, breaking) = P.partition (\(AnIssue i) -> issueIsUnsupported i) errs
39− breakingChangesPresent = not $ P.null breaking
40− unsupportedChangesPresent = not $ P.null unsupported
41− smartHeader "Summary"
42− tell $
43− simpleTable
44− (para
45− <$> [ refOpt breakingChangesPresent breakingChangesId "⚠️ Breaking changes"
46− , refOpt unsupportedChangesPresent unsupportedChangesId "🤷 Unsupported feature changes"
47− ])
48− [para . show' <$> [P.size breaking, P.size unsupported]]
49− when breakingChangesPresent $ do
50− smartHeader $ anchor breakingChangesId <> "⚠️ Breaking changes"
51− incrementHeaders $ showErrs breaking
52− when unsupportedChangesPresent $ do
53− smartHeader $ anchor unsupportedChangesId <> "🤷 Unsupported feature changes"
54− incrementHeaders $ showErrs unsupported
40+type Changes = P.PathsPrefixTree Behave AnIssue 'APILevel
41+
42+type ProcessedChanges a = P.PathsPrefixTree Behave (FunctorTuple (Const Orientation) AnIssue) a
43+
44+data FunctorTuple f g a = FunctorTuple (f a) (g a)
45+ deriving stock (Eq, Ord)
46+
47+data ReportInput = ReportInput
48+ { breakingChanges :: Changes
49+ , nonBreakingChanges :: Changes
50+ }
51+ deriving stock (Generic)
52+ deriving (Semigroup, Monoid) via (Generically ReportInput)
53+ deriving anyclass (ToJSON)
54+
55+data ReportStatus
56+ = BreakingChanges
57+ | NoBreakingChanges
58+ | -- | All changes that could be breaking are unsupported – we don't know if
59+ -- there actually are any breaking changes.
60+ OnlyUnsupportedChanges
61+
62+preprocessChanges :: Orientation -> Changes -> ProcessedChanges 'APILevel
63+preprocessChanges initialO = P.fromList . fmap process . P.toList
64+ where
65+ process :: AnItem Behave AnIssue 'APILevel -> AnItem Behave (FunctorTuple (Const Orientation) AnIssue) 'APILevel
66+ process (AnItem paths issue) = AnItem paths $ FunctorTuple (Const $ toggle initialO) issue
67+ where
68+ (Endo toggle) = togglePaths paths
69+
70+ togglePaths :: Paths Behave a c -> Endo Orientation
71+ togglePaths Root = mempty
72+ togglePaths (rest `Snoc` (_ :: Behave b c)) = case eqT @c @'ResponseLevel of
73+ Just Refl -> Endo toggleOrientation <> togglePaths rest
74+ Nothing -> togglePaths rest
75+
76+generateReport :: ReportInput -> (Pandoc, ReportStatus)
77+generateReport inp =
78+ let partitionUnsupported = P.partition (\(AnIssue i) -> issueIsUnsupported i)
79+ (bUnsupported, preprocessChanges Forward -> breaking) =
80+ partitionUnsupported $ breakingChanges inp
81+ (nbUnsupported, preprocessChanges Backward -> nonBreaking) =
82+ partitionUnsupported $ nonBreakingChanges inp
83+ unsupported = preprocessChanges Forward $ bUnsupported <> nbUnsupported
84+ breakingChangesPresent = not $ P.null breaking
85+ nonBreakingChangesPresent = not $ P.null nonBreaking
86+ unsupportedChangesPresent = not $ P.null unsupported
87+ report = doc $
88+ runReportMonad jets $ do
89+ smartHeader "Summary"
90+ tell $
91+ simpleTable
92+ (para
93+ <$> [ refOpt breakingChangesPresent breakingChangesId "⚠️ Breaking changes"
94+ , refOpt nonBreakingChangesPresent nonBreakingChangesId "🙆 Non-breaking changes"
95+ , refOpt unsupportedChangesPresent unsupportedChangesId "🤷 Unsupported feature changes"
96+ ])
97+ [para . show' <$> [P.size breaking, P.size nonBreaking, P.size unsupported]]
98+ when breakingChangesPresent $ do
99+ smartHeader $ anchor breakingChangesId <> "⚠️ Breaking changes"
100+ incrementHeaders $ showErrs breaking
101+ when nonBreakingChangesPresent $ do
102+ smartHeader $ anchor nonBreakingChangesId <> "🙆 Non-breaking changes"
103+ incrementHeaders $ showErrs nonBreaking
104+ when unsupportedChangesPresent $ do
105+ smartHeader $ anchor unsupportedChangesId <> "🤷 Unsupported feature changes"
106+ incrementHeaders $ showErrs unsupported
107+ status =
108+ if
109+ | breakingChangesPresent -> BreakingChanges
110+ | unsupportedChangesPresent -> OnlyUnsupportedChanges
111+ | otherwise -> NoBreakingChanges
112+ in (report, status)
55113 where
56114 anchor :: Text -> Inlines
57115 anchor a = spanWith (a, [], []) mempty
@@ -60,11 +118,10 @@ generateReport (Left errs) = doc $
60118 refOpt False _ i = i
61119 refOpt True a i = link ("#" <> a) "" i
62120
63− breakingChangesId :: Text
121+ breakingChangesId, nonBreakingChangesId, unsupportedChangesId :: Text
64122 breakingChangesId = "breaking-changes"
65−
66− unsupportedChangesId :: Text
67123 unsupportedChangesId = "unsupported-changes"
124+ nonBreakingChangesId = "non-breaking-changes"
68125
69126data ReportState = ReportState
70127 { sourceJets :: [ReportJet' Behave Inlines]
@@ -88,22 +145,24 @@ smartHeader i = do
88145 h <- asks headerLevel
89146 tell $ header h i
90147
91−showErrs :: forall a. Typeable a => P.PathsPrefixTree Behave AnIssue a -> ReportMonad ()
148+showErrs :: forall a. Typeable a => ProcessedChanges a -> ReportMonad ()
92149showErrs x@(P.PathsPrefixNode currentIssues _) = do
93150 let -- Extract this pattern if more cases like this arise
94− (removedPaths :: [Issue 'APILevel], otherIssues :: Set (AnIssue a)) = case eqT @a @'APILevel of
95− Just Refl ->
96− let (p, o) =
97− S.partition
98− (\(AnIssue u) -> case u of
99− NoPathsMatched {} -> True
100− AllPathsFailed {} -> True)
101− currentIssues
102− p' = S.toList p <&> (\(AnIssue i) -> i)
103− in (p', o)
104− Nothing -> (mempty, currentIssues)
151+ ( removedPaths :: [Issue 'APILevel]
152+ , otherIssues :: Set (FunctorTuple (Const Orientation) AnIssue a)
153+ ) = case eqT @a @'APILevel of
154+ Just Refl ->
155+ let (p, o) =
156+ S.partition
157+ (\(FunctorTuple _ (AnIssue u)) -> case u of
158+ NoPathsMatched {} -> True
159+ AllPathsFailed {} -> True)
160+ currentIssues
161+ p' = S.toList p <&> (\(FunctorTuple _ (AnIssue i)) -> i)
162+ in (p', o)
163+ Nothing -> (mempty, currentIssues)
105164 jts <- asks sourceJets
106− for_ otherIssues $ \(AnIssue i) -> tell . describeIssue $ i
165+ for_ otherIssues $ \(FunctorTuple (Const ori) (AnIssue i)) -> tell . describeIssue ori $ i
107166 unless ([] == removedPaths) $ do
108167 smartHeader "Removed paths"
109168 tell $
@@ -135,9 +194,9 @@ jets =
135194 <$> [ constructReportJet jsonPathJet
136195 , constructReportJet $ \p@(AtPath _) op@(InOperation _) ->
137196 strong (describeBehaviour op) <> " " <> describeBehaviour p :: Inlines
138− , constructReportJet $ \InRequest InPayload PayloadSchema -> "JSON Request" :: Inlines
197+ , constructReportJet $ \InRequest InPayload PayloadSchema -> "📱➡️ JSON Request" :: Inlines
139198 , constructReportJet $ \(WithStatusCode c) ResponsePayload PayloadSchema ->
140− "JSON Response – " <> str (T.pack . show $ c) :: Inlines
199+ "📱⬅️ JSON Response – " <> str (T.pack . show $ c) :: Inlines
141200 ]
142201 where
143202 unwrapReportJetResult :: ReportJetResult Behave x -> ReportJet' Behave x
@@ -177,8 +236,8 @@ jets =
177236
178237observeJetShowErrs
179238 :: ReportJet' Behave Inlines
180− -> P.PathsPrefixTree Behave AnIssue a
181− -> ReportMonad (P.PathsPrefixTree Behave AnIssue a)
239+ -> ProcessedChanges a
240+ -> ReportMonad (ProcessedChanges a)
182241observeJetShowErrs jet p = case observeJetShowErrs' jet p of
183242 Just m -> m
184243 Nothing -> pure p
@@ -186,8 +245,8 @@ observeJetShowErrs jet p = case observeJetShowErrs' jet p of
186245observeJetShowErrs'
187246 :: forall a.
188247 ReportJet' Behave Inlines
189− -> P.PathsPrefixTree Behave AnIssue a
190− -> Maybe (ReportMonad (P.PathsPrefixTree Behave AnIssue a))
248+ -> ProcessedChanges a
249+ -> Maybe (ReportMonad (ProcessedChanges a))
191250observeJetShowErrs' (ReportJet jet) (P.PathsPrefixNode currentIssues subIssues) =
192251 let results =
193252 subIssues >>= \(WrapTypeable (AStep m)) ->
src/OpenAPI/Checker/Run.hsnew file+30
@@ -0,0 +1,30 @@
1+module OpenAPI.Checker.Run
2+ ( runChecker
3+ , runReport
4+ , module OpenAPI.Checker.Report
5+ )
6+where
7+
8+import Data.HList
9+import Data.OpenApi (OpenApi)
10+import OpenAPI.Checker.Paths
11+import OpenAPI.Checker.Report
12+import OpenAPI.Checker.Subtree
13+import OpenAPI.Checker.Validate.OpenApi ()
14+
15+runChecker :: (OpenApi, OpenApi) -> ReportInput
16+runChecker (client, server) =
17+ ReportInput
18+ { breakingChanges = run client server
19+ , nonBreakingChanges = run server client
20+ }
21+ where
22+ toPC p c =
23+ ProdCons
24+ { producer = traced (step ClientSchema) p
25+ , consumer = traced (step ServerSchema) c
26+ }
27+ run p c = either id mempty . runCompatFormula . checkCompatibility HNil Root $ toPC p c
28+
29+runReport :: (OpenApi, OpenApi) -> (Pandoc, ReportStatus)
30+runReport = generateReport . runChecker
src/OpenAPI/Checker/Subtree/Deriving.hsdeleted−6
@@ -1,6 +0,0 @@
1−module OpenAPI.Checker.Subtree.Deriving (EqSubtree (..)) where
2−
3−import Control.Monad
4−import OpenAPI.Checker.Subtree
5−
6−newtype EqSubtree t = EqSubtree t
src/OpenAPI/Checker/Validate/Header.hs+5−3
@@ -51,9 +51,11 @@ instance Issuable 'HeaderLevel where
5151 | HeaderSchemaRequired
5252 deriving stock (Eq, Ord, Show)
5353 issueIsUnsupported _ = False
54− describeIssue RequiredHeaderMissing = para "Header has become required."
55− describeIssue NonEmptyHeaderRequired = para "The header does not allow empty values anymore."
56− describeIssue HeaderSchemaRequired = para "Expected header schema, but it is not present."
54+ describeIssue Forward RequiredHeaderMissing = para "Header has become required."
55+ describeIssue Backward RequiredHeaderMissing = para "Header is no longer required."
56+ describeIssue Forward NonEmptyHeaderRequired = para "The header does not allow empty values anymore."
57+ describeIssue Backward NonEmptyHeaderRequired = para "The header now allows empty values."
58+ describeIssue _ HeaderSchemaRequired = para "Expected header schema, but it is not present."
5759
5860instance Behavable 'HeaderLevel 'SchemaLevel where
5961 data Behave 'HeaderLevel 'SchemaLevel
src/OpenAPI/Checker/Validate/Link.hs+1−1
@@ -19,4 +19,4 @@ instance Issuable 'LinkLevel where
1919 deriving stock (Eq, Ord, Show)
2020 issueIsUnsupported = \case
2121 LinksUnsupported -> True
22− describeIssue LinksUnsupported = para "OpenApi Diff does not currently support Link Objects."
22+ describeIssue _ LinksUnsupported = para "OpenApi Diff does not currently support Link Objects."
src/OpenAPI/Checker/Validate/MediaTypeObject.hs+13−7
@@ -42,9 +42,10 @@ instance Issuable 'PayloadLevel where
4242 EncodingNotSupported -> True
4343 _ -> False
4444
45− describeIssue MediaTypeSchemaRequired = para "Media type expected, but was not specified."
46− describeIssue (MediaEncodingMissing enc) = para $ "Media encoding " <> str enc <> " added."
47− describeIssue EncodingNotSupported = para "OpenApi Diff does not currently support media encodings other than JSON."
45+ describeIssue _ MediaTypeSchemaRequired = para "Media type expected, but was not specified."
46+ describeIssue Forward (MediaEncodingMissing enc) = para $ "Media encoding " <> str enc <> " has been removed."
47+ describeIssue Backward (MediaEncodingMissing enc) = para $ "Media encoding " <> str enc <> " added."
48+ describeIssue _ EncodingNotSupported = para "OpenApi Diff does not currently support media encodings other than JSON."
4849
4950instance Behavable 'PayloadLevel 'SchemaLevel where
5051 data Behave 'PayloadLevel 'SchemaLevel
@@ -153,11 +154,16 @@ instance Issuable 'OperationLevel where
153154 deriving stock (Eq, Ord, Show)
154155 issueIsUnsupported = \case
155156 _ -> False
156− describeIssue (ResponseCodeNotFound c) =
157+ describeIssue Forward (ResponseCodeNotFound c) =
157158 para $ "Reponse code " <> (str . T.pack . show $ c) <> " has been added."
158− describeIssue (ParamNotMatched param) =
159+ describeIssue Backward (ResponseCodeNotFound c) =
160+ para $ "Reponse code " <> (str . T.pack . show $ c) <> " has been removed."
161+ describeIssue Forward (ParamNotMatched param) =
159162 para $ "Parameter " <> code param <> " has become required."
160− describeIssue (PathFragmentNotMatched i) =
163+ describeIssue Backward (ParamNotMatched param) =
164+ para $ "Parameter " <> code param <> " is no longer required."
165+ describeIssue _ (PathFragmentNotMatched i) =
161166 -- TODO: Indices are meaningless in this context. Replace with a better error.
162167 para $ "Path fragment " <> (str . T.pack . show $ i) <> " not matched."
163− describeIssue NoRequestBody = para "Request body has been added."
168+ describeIssue Forward NoRequestBody = para "Request body has been added."
169+ describeIssue Backward NoRequestBody = para "Request body has been removed."
src/OpenAPI/Checker/Validate/OAuth2Flows.hs+28−20
@@ -104,8 +104,9 @@ instance Issuable 'SecurityRequirementLevel where
104104 | UndefinedSecurityScheme Text
105105 deriving stock (Eq, Ord, Show)
106106 issueIsUnsupported _ = False
107− describeIssue SecurityRequirementNotMet = para "Security scheme has been removed."
108− describeIssue (UndefinedSecurityScheme k) = para $ "Security scheme " <> code k <> " is not defined."
107+ describeIssue Forward SecurityRequirementNotMet = para "Security scheme has been removed."
108+ describeIssue Backward SecurityRequirementNotMet = para "Security scheme was added."
109+ describeIssue _ (UndefinedSecurityScheme k) = para $ "Security scheme " <> code k <> " is not defined."
109110
110111instance Issuable 'SecuritySchemeLevel where
111112 data Issue 'SecuritySchemeLevel
@@ -129,26 +130,33 @@ instance Issuable 'SecuritySchemeLevel where
129130 | ScopeNotDefined Text
130131 deriving stock (Eq, Ord, Show)
131132 issueIsUnsupported _ = False
132− describeIssue RefreshUrlsDontMatch = para "Refresh URL changed."
133− describeIssue (HttpSchemeTypesDontMatch _ _) = para "HTTP scheme type changed."
134− describeIssue (ApiKeyParamsDontMatch _ _) = para "API Key parameters changed."
135− describeIssue (OpenIdConnectUrlsDontMatch _ _) = para "OpenaId Connect URL changed."
136− describeIssue (CustomHttpSchemesDontMatch e a) =
133+ describeIssue _ RefreshUrlsDontMatch = para "Refresh URL changed."
134+ describeIssue _ (HttpSchemeTypesDontMatch _ _) = para "HTTP scheme type changed."
135+ describeIssue _ (ApiKeyParamsDontMatch _ _) = para "API Key parameters changed."
136+ describeIssue _ (OpenIdConnectUrlsDontMatch _ _) = para "OpenaId Connect URL changed."
137+ describeIssue _ (CustomHttpSchemesDontMatch e a) =
137138 para $ "Changed HTTP scheme from " <> code e <> " to " <> code a <> "."
138− describeIssue ConsumerDoesNotSupportImplicitFlow = para "Implicit flow support has been removed."
139− describeIssue ConsumerDoesNotSupportPasswordFlow = para "Password flow support has been removed."
140− describeIssue ConsumerDoesNotSupportClientCridentialsFlow = para "Client Cridentials flow support has been removed."
141− describeIssue ConsumerDoesNotSupportAuthorizationCodeFlow = para "Authorization Code flow support has been removed."
142− describeIssue SecuritySchemeNotMatched = para "Security scheme has been removed."
143− describeIssue OAuth2ImplicitFlowNotEqual = para "Implicit Flow changed."
144− describeIssue OAuth2PasswordFlowNotEqual = para "Password Flow changed."
145− describeIssue OAuth2ClientCredentialsFlowNotEqual = para "Client Cridentials Flow changed."
146− describeIssue OAuth2AuthorizationCodeFlowNotEqual = para "Authorization Code Flow changed."
147− describeIssue (ScopesMissing ss) =
139+ describeIssue Forward ConsumerDoesNotSupportImplicitFlow = para "Implicit flow support has been removed."
140+ describeIssue Backward ConsumerDoesNotSupportImplicitFlow = para "Implicit flow support has been added."
141+ describeIssue Forward ConsumerDoesNotSupportPasswordFlow = para "Password flow support has been removed."
142+ describeIssue Backward ConsumerDoesNotSupportPasswordFlow = para "Password flow support has been added."
143+ describeIssue Forward ConsumerDoesNotSupportClientCridentialsFlow = para "Client Cridentials flow support has been removed."
144+ describeIssue Backward ConsumerDoesNotSupportClientCridentialsFlow = para "Client Cridentials flow support has been added."
145+ describeIssue Forward ConsumerDoesNotSupportAuthorizationCodeFlow = para "Authorization Code flow support has been removed."
146+ describeIssue Backward ConsumerDoesNotSupportAuthorizationCodeFlow = para "Authorization Code flow support has been added."
147+ describeIssue Forward SecuritySchemeNotMatched = para "Security scheme has been removed."
148+ describeIssue Backward SecuritySchemeNotMatched = para "Security scheme has been added."
149+ describeIssue _ OAuth2ImplicitFlowNotEqual = para "Implicit Flow changed."
150+ describeIssue _ OAuth2PasswordFlowNotEqual = para "Password Flow changed."
151+ describeIssue _ OAuth2ClientCredentialsFlowNotEqual = para "Client Cridentials Flow changed."
152+ describeIssue _ OAuth2AuthorizationCodeFlowNotEqual = para "Authorization Code Flow changed."
153+ describeIssue Forward (ScopesMissing ss) =
148154 para "New scopes required:" <> bulletList (S.toList ss <&> codeBlock)
149− describeIssue DifferentSecuritySchemes = para "Completely different security scheme types."
150− describeIssue CanNotHaveScopes = para "The specified security scheme can not have scopes."
151− describeIssue (ScopeNotDefined k) = para $ "Scope with key " <> code k <> " is not defined."
155+ describeIssue Backward (ScopesMissing ss) =
156+ para "Scopes no longer required:" <> bulletList (S.toList ss <&> codeBlock)
157+ describeIssue _ DifferentSecuritySchemes = para "Completely different security scheme types."
158+ describeIssue _ CanNotHaveScopes = para "The specified security scheme can not have scopes."
159+ describeIssue _ (ScopeNotDefined k) = para $ "Scope with key " <> code k <> " is not defined."
152160
153161instance Behavable 'SecurityRequirementLevel 'SecuritySchemeLevel where
154162 data Behave 'SecurityRequirementLevel 'SecuritySchemeLevel
src/OpenAPI/Checker/Validate/Operation.hs+7−4
@@ -359,8 +359,10 @@ instance Issuable 'APILevel where
359359 -- When several paths match given but all checks failed
360360 deriving stock (Eq, Ord, Show)
361361 issueIsUnsupported _ = False
362− describeIssue (NoPathsMatched p) = para $ "The path " <> (code . T.pack) p <> " has been removed."
363− describeIssue (AllPathsFailed p) = para $ "The path " <> (code . T.pack) p <> " has been removed."
362+ describeIssue Forward (NoPathsMatched p) = para $ "The path " <> (code . T.pack) p <> " has been removed."
363+ describeIssue Backward (NoPathsMatched p) = para $ "The path " <> (code . T.pack) p <> " has been added."
364+ describeIssue Forward (AllPathsFailed p) = para $ "The path " <> (code . T.pack) p <> " has been removed."
365+ describeIssue Backward (AllPathsFailed p) = para $ "The path " <> (code . T.pack) p <> " has been added."
364366
365367instance Behavable 'APILevel 'PathLevel where
366368 data Behave 'APILevel 'PathLevel
@@ -462,7 +464,8 @@ instance Issuable 'PathLevel where
462464 = OperationMissing OperationMethod
463465 deriving stock (Eq, Ord, Show)
464466 issueIsUnsupported _ = False
465− describeIssue (OperationMissing op) = para $ "Method " <> strong (showMethod op) <> " has been removed."
467+ describeIssue Forward (OperationMissing op) = para $ "Method " <> strong (showMethod op) <> " has been removed."
468+ describeIssue Backward (OperationMissing op) = para $ "Method " <> strong (showMethod op) <> " has been added."
466469
467470instance Behavable 'PathLevel 'OperationLevel where
468471 data Behave 'PathLevel 'OperationLevel
@@ -579,7 +582,7 @@ instance Issuable 'CallbackLevel where
579582 deriving stock (Eq, Ord, Show)
580583 issueIsUnsupported = \case
581584 CallbacksUnsupported -> True
582− describeIssue CallbacksUnsupported = para "OpenApi Diff does not currently support callbacks."
585+ describeIssue _ CallbacksUnsupported = para "OpenApi Diff does not currently support callbacks."
583586
584587tracedCallbackPathItems :: Traced Callback -> Traced ProcessedPathItems
585588tracedCallbackPathItems (Traced t (Callback x)) =
src/OpenAPI/Checker/Validate/Param.hs+9−7
@@ -69,13 +69,15 @@ instance Issuable 'PathFragmentLevel where
6969 | PathFragmentsDontMatch Text Text
7070 deriving stock (Eq, Ord, Show)
7171 issueIsUnsupported _ = False
72− describeIssue ParamNameMismatch = para "The path fragments don't match."
73− describeIssue ParamEmptinessIncompatible = para "Expected that an empty parameter is allowed, but it isn't."
74− describeIssue ParamRequired = para "Parameter has become required."
75− describeIssue ParamPlaceIncompatible = para "Parameters in incompatible locations."
76− describeIssue ParamStyleMismatch = para "Different parameter styles (encodings)."
77− describeIssue ParamSchemaMismatch = para "Expected a schema, but didn't find one."
78− describeIssue (PathFragmentsDontMatch e a) = para $ "Parameter changed from " <> code e <> " to " <> code a <> "."
72+ describeIssue _ ParamNameMismatch = para "The path fragments don't match."
73+ describeIssue Forward ParamEmptinessIncompatible = para "The parameter can no longer be empty."
74+ describeIssue Backward ParamEmptinessIncompatible = para "The parameter can now be empty."
75+ describeIssue Forward ParamRequired = para "Parameter has become required."
76+ describeIssue Backward ParamRequired = para "Parameter is no longer required."
77+ describeIssue _ ParamPlaceIncompatible = para "Parameters in incompatible locations."
78+ describeIssue _ ParamStyleMismatch = para "Different parameter styles (encodings)."
79+ describeIssue _ ParamSchemaMismatch = para "Expected a schema, but didn't find one."
80+ describeIssue _ (PathFragmentsDontMatch e a) = para $ "Parameter changed from " <> code e <> " to " <> code a <> "."
7981
8082instance Behavable 'PathFragmentLevel 'SchemaLevel where
8183 data Behave 'PathFragmentLevel 'SchemaLevel
src/OpenAPI/Checker/Validate/RequestBody.hs+6−2
@@ -31,10 +31,14 @@ instance Issuable 'RequestLevel where
3131 | RequestMediaTypeNotFound MediaType
3232 deriving stock (Eq, Ord, Show)
3333 issueIsUnsupported _ = False
34− describeIssue RequestBodyRequired =
34+ describeIssue Forward RequestBodyRequired =
3535 para "Request body has become required."
36− describeIssue (RequestMediaTypeNotFound t) =
36+ describeIssue Backward RequestBodyRequired =
37+ para "Request body is no longer required."
38+ describeIssue Forward (RequestMediaTypeNotFound t) =
3739 para $ "Media type " <> (code . T.pack . show $ t) <> " has been removed."
40+ describeIssue Backward (RequestMediaTypeNotFound t) =
41+ para $ "Media type " <> (code . T.pack . show $ t) <> " has been added."
3842
3943instance Behavable 'RequestLevel 'PayloadLevel where
4044 data Behave 'RequestLevel 'PayloadLevel
src/OpenAPI/Checker/Validate/Responses.hs+6−2
@@ -72,10 +72,14 @@ instance Issuable 'ResponseLevel where
7272 | ResponseHeaderMissing HeaderName
7373 deriving stock (Eq, Ord, Show)
7474 issueIsUnsupported _ = False
75− describeIssue (ResponseMediaTypeMissing t) =
75+ describeIssue Forward (ResponseMediaTypeMissing t) =
76+ para $ "Media type was removed: " <> (code . T.pack . show $ t) <> "."
77+ describeIssue Backward (ResponseMediaTypeMissing t) =
7678 para $ "New media type was added: " <> (code . T.pack . show $ t) <> "."
77− describeIssue (ResponseHeaderMissing h) =
79+ describeIssue Forward (ResponseHeaderMissing h) =
7880 para $ "New header was added " <> code h <> "."
81+ describeIssue Backward (ResponseHeaderMissing h) =
82+ para $ "Header was removed " <> code h <> "."
7983
8084instance Behavable 'ResponseLevel 'PayloadLevel where
8185 data Behave 'ResponseLevel 'PayloadLevel
src/OpenAPI/Checker/Validate/Schema.hs+53−33
@@ -1057,38 +1057,58 @@ instance Issuable 'TypedSchemaLevel where
10571057 NoContradiction
10581058 deriving stock (Eq, Ord, Show)
10591059 issueIsUnsupported _ = False
1060− describeIssue (EnumDoesntSatisfy v) = para "The following enum value was added:" <> showJSONValue v
1061− describeIssue (NoMatchingEnum v) = para "The following enum value has been removed:" <> showJSONValue v
1062− describeIssue (NoMatchingMaximum b) = para $ "Upper bound has been added:" <> showBound b <> "."
1063− describeIssue (MatchingMaximumWeak (ProdCons p c)) = para $ "Upper bound changed from " <> showBound p <> " to " <> showBound c <> "."
1064− describeIssue (NoMatchingMinimum b) = para $ "Lower bound has been added: " <> showBound b <> "."
1065− describeIssue (MatchingMinimumWeak (ProdCons p c)) = para $ "Lower bound changed from " <> showBound p <> " to " <> showBound c <> "."
1066− describeIssue (NoMatchingMultipleOf n) = para $ "Value is now a multiple of " <> show' n <> "."
1067− describeIssue (MatchingMultipleOfWeak (ProdCons p c)) = para $ "Value changed from being a multiple of " <> show' p <> " to being a multiple of " <> show' c <> "."
1068− describeIssue (NoMatchingFormat f) = para $ "Format added: " <> code f <> "."
1069− describeIssue (NoMatchingMaxLength n) = para $ "Maximum length added: " <> show' n <> "."
1070− describeIssue (MatchingMaxLengthWeak (ProdCons p c)) = para $ "Maximum length of the string changed from " <> show' p <> " to " <> show' c <> "."
1071− describeIssue (NoMatchingMinLength n) = para $ "Minimum length of the string added: " <> show' n <> "."
1072− describeIssue (MatchingMinLengthWeak (ProdCons p c)) = para $ "Minimum length of the string changed from " <> show' p <> " to " <> show' c <> "."
1073− describeIssue (NoMatchingPattern p) = para "Pattern (regular expression) added: " <> codeBlock p
1074− describeIssue NoMatchingItems = para "Array item schema has been added."
1075− describeIssue (NoMatchingMaxItems n) = para $ "Maximum length of the array has been added " <> show' n <> "."
1076− describeIssue (MatchingMaxItemsWeak (ProdCons p c)) = para $ "Maximum length of the array changed from " <> show' p <> " to " <> show' c <> "."
1077− describeIssue (NoMatchingMinItems n) = para $ "Minimum length of the array added: " <> show' n <> "."
1078− describeIssue (MatchingMinItemsWeak (ProdCons p c)) = para $ "Minimum length of the array changed from " <> show' p <> " to " <> show' c <> "."
1079− describeIssue NoMatchingUniqueItems = para "Items are now required to be unique."
1080− describeIssue NoMatchingProperties = para "Property added."
1081− describeIssue (UnexpectedProperty p) = para $ "Property " <> code p <> " has been removed."
1082− describeIssue (PropertyNowRequired p) = para $ "Property " <> code p <> " has become required."
1083− describeIssue NoAdditionalProperties = para "Additional properties have been removed."
1084− describeIssue (NoMatchingMaxProperties n) = para $ "Maximum number of properties has been added: " <> show' n <> "."
1085− describeIssue (MatchingMaxPropertiesWeak (ProdCons p c)) = para $ "Maximum number of properties has changed from " <> show' p <> " to " <> show' c <> "."
1086− describeIssue (NoMatchingMinProperties n) = para $ "Minimum number of properties added: " <> show' n <> "."
1087− describeIssue (MatchingMinPropertiesWeak (ProdCons p c)) = para $ "Minimum number of properties has changed from " <> show' p <> " to " <> show' c <> "."
1088− describeIssue (NoMatchingCondition conds) =
1060+ describeIssue Forward (EnumDoesntSatisfy v) = para "The following enum value was added:" <> showJSONValue v
1061+ describeIssue Backward (EnumDoesntSatisfy v) = para "The following enum value was removed:" <> showJSONValue v
1062+ describeIssue Forward (NoMatchingEnum v) = para "The following enum value has been removed:" <> showJSONValue v
1063+ describeIssue Backward (NoMatchingEnum v) = para "The following enum value has been added:" <> showJSONValue v
1064+ describeIssue Forward (NoMatchingMaximum b) = para $ "Upper bound has been added:" <> showBound b <> "."
1065+ describeIssue Backward (NoMatchingMaximum b) = para $ "Upper bound has been removed:" <> showBound b <> "."
1066+ describeIssue _ (MatchingMaximumWeak (ProdCons p c)) = para $ "Upper bound changed from " <> showBound p <> " to " <> showBound c <> "."
1067+ describeIssue Forward (NoMatchingMinimum b) = para $ "Lower bound has been added: " <> showBound b <> "."
1068+ describeIssue Backward (NoMatchingMinimum b) = para $ "Lower bound has been removed: " <> showBound b <> "."
1069+ describeIssue _ (MatchingMinimumWeak (ProdCons p c)) = para $ "Lower bound changed from " <> showBound p <> " to " <> showBound c <> "."
1070+ describeIssue Forward (NoMatchingMultipleOf n) = para $ "Value is now a multiple of " <> show' n <> "."
1071+ describeIssue Backward (NoMatchingMultipleOf n) = para $ "Value is no longer a multiple of " <> show' n <> "."
1072+ describeIssue _ (MatchingMultipleOfWeak (ProdCons p c)) = para $ "Value changed from being a multiple of " <> show' p <> " to being a multiple of " <> show' c <> "."
1073+ describeIssue Forward (NoMatchingFormat f) = para $ "Format added: " <> code f <> "."
1074+ describeIssue Backward (NoMatchingFormat f) = para $ "Format removed: " <> code f <> "."
1075+ describeIssue Forward (NoMatchingMaxLength n) = para $ "Maximum length added: " <> show' n <> "."
1076+ describeIssue Backward (NoMatchingMaxLength n) = para $ "Maximum length removed: " <> show' n <> "."
1077+ describeIssue _ (MatchingMaxLengthWeak (ProdCons p c)) = para $ "Maximum length of the string changed from " <> show' p <> " to " <> show' c <> "."
1078+ describeIssue Forward (NoMatchingMinLength n) = para $ "Minimum length of the string added: " <> show' n <> "."
1079+ describeIssue Backward (NoMatchingMinLength n) = para $ "Minimum length of the string removed: " <> show' n <> "."
1080+ describeIssue _ (MatchingMinLengthWeak (ProdCons p c)) = para $ "Minimum length of the string changed from " <> show' p <> " to " <> show' c <> "."
1081+ describeIssue Forward (NoMatchingPattern p) = para "Pattern (regular expression) added: " <> codeBlock p
1082+ describeIssue Backward (NoMatchingPattern p) = para "Pattern (regular expression) removed: " <> codeBlock p
1083+ describeIssue Forward NoMatchingItems = para "Array item schema has been added."
1084+ describeIssue Backward NoMatchingItems = para "Array item schema has been removed."
1085+ describeIssue Forward (NoMatchingMaxItems n) = para $ "Maximum length of the array has been added " <> show' n <> "."
1086+ describeIssue Backward (NoMatchingMaxItems n) = para $ "Maximum length of the array has been removed " <> show' n <> "."
1087+ describeIssue _ (MatchingMaxItemsWeak (ProdCons p c)) = para $ "Maximum length of the array changed from " <> show' p <> " to " <> show' c <> "."
1088+ describeIssue Forward (NoMatchingMinItems n) = para $ "Minimum length of the array added: " <> show' n <> "."
1089+ describeIssue Backward (NoMatchingMinItems n) = para $ "Minimum length of the array removed: " <> show' n <> "."
1090+ describeIssue _ (MatchingMinItemsWeak (ProdCons p c)) = para $ "Minimum length of the array changed from " <> show' p <> " to " <> show' c <> "."
1091+ describeIssue Forward NoMatchingUniqueItems = para "Items are now required to be unique."
1092+ describeIssue Backward NoMatchingUniqueItems = para "Items are no longer required to be unique."
1093+ describeIssue Forward NoMatchingProperties = para "Property added."
1094+ describeIssue Backward NoMatchingProperties = para "Property removed."
1095+ describeIssue Forward (UnexpectedProperty p) = para $ "Property " <> code p <> " has been removed."
1096+ describeIssue Backward (UnexpectedProperty p) = para $ "Property " <> code p <> " has been added."
1097+ describeIssue Forward (PropertyNowRequired p) = para $ "Property " <> code p <> " has become required."
1098+ describeIssue Backward (PropertyNowRequired p) = para $ "Property " <> code p <> " may not be present."
1099+ describeIssue Forward NoAdditionalProperties = para "Additional properties have been removed."
1100+ describeIssue Backward NoAdditionalProperties = para "Additional properties have been added."
1101+ describeIssue Forward (NoMatchingMaxProperties n) = para $ "Maximum number of properties has been added: " <> show' n <> "."
1102+ describeIssue Backward (NoMatchingMaxProperties n) = para $ "Maximum number of properties has been removed: " <> show' n <> "."
1103+ describeIssue _ (MatchingMaxPropertiesWeak (ProdCons p c)) = para $ "Maximum number of properties has changed from " <> show' p <> " to " <> show' c <> "."
1104+ describeIssue Forward (NoMatchingMinProperties n) = para $ "Minimum number of properties added: " <> show' n <> "."
1105+ describeIssue Backward (NoMatchingMinProperties n) = para $ "Minimum number of properties removed: " <> show' n <> "."
1106+ describeIssue _ (MatchingMinPropertiesWeak (ProdCons p c)) = para $ "Minimum number of properties has changed from " <> show' p <> " to " <> show' c <> "."
1107+ describeIssue _ (NoMatchingCondition conds) =
10891108 para "Expected the following conditions to hold, but they didn't (please file a bug if you see this):"
10901109 <> bulletList ((\(SomeCondition c) -> showCondition c) <$> conds)
1091− describeIssue NoContradiction = para "The type has been removed."
1110+ describeIssue Forward NoContradiction = para "The type has been removed."
1111+ describeIssue Backward NoContradiction = para "The type has been added."
10921112
10931113showJSONValue :: A.Value -> Blocks
10941114showJSONValue v = codeBlockWith ("", ["json"], mempty) (T.decodeUtf8 . BSL.toStrict . A.encode $ v)
@@ -1111,11 +1131,11 @@ instance Issuable 'SchemaLevel where
11111131 deriving stock (Eq, Ord, Show)
11121132 issueIsUnsupported _ = True
11131133
1114− describeIssue (NotSupported i) =
1134+ describeIssue _ (NotSupported i) =
11151135 para (emph "Encountered a feature that OpenApi Diff does not support: " <> text i <> ".")
1116− describeIssue (InvalidSchema i) =
1136+ describeIssue _ (InvalidSchema i) =
11171137 para (emph "The schema is invalid: " <> text i <> ".")
1118− describeIssue UnguardedRecursion =
1138+ describeIssue _ UnguardedRecursion =
11191139 para "Encountered recursion that is too complex for OpenApi Diff to untangle."
11201140
11211141instance Behavable 'SchemaLevel 'TypedSchemaLevel where
src/OpenAPI/Checker/Validate/Server.hs+9−4
@@ -134,13 +134,18 @@ instance Issuable 'ServerLevel where
134134 | ServerNotMatched
135135 deriving stock (Eq, Ord, Show)
136136 issueIsUnsupported _ = False
137− describeIssue (EnumValueNotConsumed _ v) =
137+ describeIssue Forward (EnumValueNotConsumed _ v) =
138138 para $ "Enum value " <> code v <> " has been removed."
139− describeIssue (ConsumerNotOpen _) =
139+ describeIssue Backward (EnumValueNotConsumed _ v) =
140+ para $ "Enum value " <> code v <> " has been added."
141+ describeIssue Forward (ConsumerNotOpen _) =
140142 para $ "A variable has been changed from being open to being closed."
141− describeIssue (ServerVariableNotDefined k) =
143+ describeIssue Backward (ConsumerNotOpen _) =
144+ para $ "A variable has been changed from being closed to being open."
145+ describeIssue _ (ServerVariableNotDefined k) =
142146 para $ "Variable " <> code k <> " is not defined."
143− describeIssue ServerNotMatched = para $ "The server was removed."
147+ describeIssue Forward ServerNotMatched = para $ "The server was removed."
148+ describeIssue Backward ServerNotMatched = para $ "The server was added."
144149
145150instance Subtree ProcessedServer where
146151 type SubtreeLevel ProcessedServer = 'ServerLevel
stack.yaml+1−1
@@ -1,4 +1,4 @@
1−resolver: nightly-2021-06-10
1+resolver: lts-18.0
22
33extra-deps:
44 - open-union-0.4.0.0
stack.yaml.lock+4−4
@@ -20,7 +20,7 @@ packages:
2020 hackage: type-fun-0.1.3
2121snapshots:
2222- completed:
23− size: 585361
24− url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2021/6/10.yaml
25− sha256: ef53458d54ca6084c6d8eb5219d03b38878e999af607cf006d5be86669d9a696
26− original: nightly-2021-06-10
23+ size: 585393
24+ url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/0.yaml
25+ sha256: c632012da648385b9fa3c29f4e0afd56ead299f1c5528ee789058be410e883c0
26+ original: lts-18.0
test/Spec.hs+1−1
@@ -9,4 +9,4 @@ main = defaultMain =<< tests
99tests :: IO TestTree
1010tests = do
1111 goldenReportTree <- Spec.Golden.TraceTree.tests
12− return . localOption (mkTimeout 1000000) $ goldenReportTree
12+ return . localOption (mkTimeout 5000000) $ goldenReportTree
test/Spec/Golden/TraceTree.hs+2−17
@@ -7,16 +7,10 @@ import Control.Category
77import Control.Exception
88import qualified Data.ByteString.Lazy as BSL
99import Data.Default
10−import Data.HList
11−import Data.OpenApi
1210import Data.Text (Text)
1311import qualified Data.Text.Encoding as T
1412import qualified Data.Yaml as Yaml
15−import OpenAPI.Checker.Behavior
16−import OpenAPI.Checker.Paths
17−import OpenAPI.Checker.PathsPrefixTree
18−import OpenAPI.Checker.Report
19−import OpenAPI.Checker.Subtree
13+import OpenAPI.Checker.Run
2014import OpenAPI.Checker.Validate.OpenApi ()
2115import Spec.Golden.Extra
2216import Test.Tasty (TestTree, testGroup)
@@ -43,18 +37,9 @@ tests = do
4337 "report.md"
4438 ("a.yaml", "b.yaml")
4539 Yaml.decodeFileThrow
46− (runPandoc . writeMarkdown def {writerExtensions = githubMarkdownExtensions} . generateReport . runChecker)
40+ (runPandoc . writeMarkdown def {writerExtensions = githubMarkdownExtensions} . fst . runReport)
4741
4842 return $ testGroup "Golden tests" [traceTreeTests, reportTests]
4943
5044runPandoc :: PandocPure Text -> IO BSL.ByteString
5145runPandoc = either throwIO (pure . BSL.fromStrict . T.encodeUtf8) . runPure
52−
53−runChecker :: (OpenApi, OpenApi) -> Either (PathsPrefixTree Behave AnIssue 'APILevel) ()
54−runChecker = runCompatFormula . checkCompatibility HNil Root . toPC
55− where
56− toPC (c, s) =
57− ProdCons
58− { producer = traced (step ClientSchema) c
59− , consumer = traced (step ServerSchema) s
60− }
test/golden/common/enum-anyof/report.md+5−1
@@ -1 +1,5 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | 🙆 Non-breaking changes | 🤷 Unsupported feature changes |
4+|---------------------|------------------------|-------------------------------|
5+| 0 | 0 | 0 |
test/golden/common/enum-anyof/trace-tree.yaml+2−1
@@ -1 +1,2 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges: {}
test/golden/common/id/report.md+5−1
@@ -1 +1,5 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | 🙆 Non-breaking changes | 🤷 Unsupported feature changes |
4+|---------------------|------------------------|-------------------------------|
5+| 0 | 0 | 0 |
test/golden/common/id/trace-tree.yaml+2−1
@@ -1 +1,2 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges: {}
test/golden/common/json/recursive/report.md+5−1
@@ -1 +1,5 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | 🙆 Non-breaking changes | 🤷 Unsupported feature changes |
4+|---------------------|------------------------|-------------------------------|
5+| 0 | 0 | 0 |
test/golden/common/json/recursive/trace-tree.yaml+2−1
@@ -1 +1,2 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges: {}
test/golden/common/maximum-lowered/report.md+14−4
@@ -1,14 +1,24 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 1 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|------------------------------------------|-------------------------------------------------|-------------------------------|
5+| 1 | 1 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
99## **POST** /test
1010
11−### JSON Request
11+### 📱➡️ JSON Request
12+
13+#### `$(Number)`
14+
15+Upper bound changed from 3.0 inclusive to 2.0 inclusive.
16+
17+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
18+
19+## **POST** /test
20+
21+### 📱⬅️ JSON Response – 200
1222
1323#### `$(Number)`
1424
test/golden/common/maximum-lowered/trace-tree.yaml+9−1
@@ -1,4 +1,4 @@
1−Left:
1+breakingChanges:
22 AtPath "/test":
33 InOperation PostMethod:
44 InRequest:
@@ -6,3 +6,11 @@ Left:
66 PayloadSchema:
77 OfType Number: MatchingMaximumWeak (ProdCons {producer = Inclusive 3.0,
88 consumer = Inclusive 2.0})
9+nonBreakingChanges:
10+ AtPath "/test":
11+ InOperation PostMethod:
12+ WithStatusCode 200:
13+ ResponsePayload:
14+ PayloadSchema:
15+ OfType Number: MatchingMaximumWeak (ProdCons {producer = Inclusive 3.0,
16+ consumer = Inclusive 2.0})
test/golden/common/pathItem/operation/parameters/allowEmptyValue/reset/report.md+4−4
@@ -1,8 +1,8 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 1 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | 🙆 Non-breaking changes | 🤷 Unsupported feature changes |
4+|------------------------------------------|------------------------|-------------------------------|
5+| 1 | 0 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
@@ -10,4 +10,4 @@
1010
1111### Parameter test1
1212
13−Expected that an empty parameter is allowed, but it isn't.
13+The parameter can no longer be empty.
test/golden/common/pathItem/operation/parameters/allowEmptyValue/reset/trace-tree.yaml+2−1
@@ -1,4 +1,5 @@
1−Left:
1+breakingChanges:
22 AtPath "/test":
33 InOperation PostMethod:
44 InParam "test1": ParamEmptinessIncompatible
5+nonBreakingChanges: {}
test/golden/common/pathItem/operation/parameters/allowEmptyValue/set/report.md+13−1
@@ -1 +1,13 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|---------------------|-------------------------------------------------|-------------------------------|
5+| 0 | 1 | 0 |
6+
7+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
8+
9+## **POST** /test
10+
11+### Parameter test1
12+
13+The parameter can now be empty.
test/golden/common/pathItem/operation/parameters/allowEmptyValue/set/trace-tree.yaml+5−1
@@ -1 +1,5 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges:
3+ AtPath "/test":
4+ InOperation PostMethod:
5+ InParam "test1": ParamEmptinessIncompatible
test/golden/common/pathItem/operation/parameters/change/report.md+15−3
@@ -1,8 +1,8 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 1 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|------------------------------------------|-------------------------------------------------|-------------------------------|
5+| 1 | 1 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
@@ -15,3 +15,15 @@
1515##### `$(String)`
1616
1717The type has been removed.
18+
19+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
20+
21+## **POST** /test
22+
23+### Parameter test
24+
25+#### JSON Schema
26+
27+##### `$(Number)`
28+
29+The type has been added.
test/golden/common/pathItem/operation/parameters/change/trace-tree.yaml+7−1
@@ -1,6 +1,12 @@
1−Left:
1+breakingChanges:
22 AtPath "/test":
33 InOperation PostMethod:
44 InParam "test":
55 InParamSchema:
66 OfType String: NoContradiction
7+nonBreakingChanges:
8+ AtPath "/test":
9+ InOperation PostMethod:
10+ InParam "test":
11+ InParamSchema:
12+ OfType Number: NoContradiction
test/golden/common/pathItem/operation/parameters/required/false/add/report.md+5−1
@@ -1 +1,5 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | 🙆 Non-breaking changes | 🤷 Unsupported feature changes |
4+|---------------------|------------------------|-------------------------------|
5+| 0 | 0 | 0 |
test/golden/common/pathItem/operation/parameters/required/false/add/trace-tree.yaml+2−1
@@ -1 +1,2 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges: {}
test/golden/common/pathItem/operation/parameters/required/false/del/report.md+5−1
@@ -1 +1,5 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | 🙆 Non-breaking changes | 🤷 Unsupported feature changes |
4+|---------------------|------------------------|-------------------------------|
5+| 0 | 0 | 0 |
test/golden/common/pathItem/operation/parameters/required/false/del/trace-tree.yaml+2−1
@@ -1 +1,2 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges: {}
test/golden/common/pathItem/operation/parameters/required/reset/report.md+13−1
@@ -1 +1,13 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|---------------------|-------------------------------------------------|-------------------------------|
5+| 0 | 1 | 0 |
6+
7+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
8+
9+## **POST** /test
10+
11+### Parameter test1
12+
13+Parameter is no longer required.
test/golden/common/pathItem/operation/parameters/required/reset/trace-tree.yaml+5−1
@@ -1 +1,5 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges:
3+ AtPath "/test":
4+ InOperation PostMethod:
5+ InParam "test1": ParamRequired
test/golden/common/pathItem/operation/parameters/required/set/report.md+3−3
@@ -1,8 +1,8 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 1 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | 🙆 Non-breaking changes | 🤷 Unsupported feature changes |
4+|------------------------------------------|------------------------|-------------------------------|
5+| 1 | 0 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
test/golden/common/pathItem/operation/parameters/required/set/trace-tree.yaml+2−1
@@ -1,4 +1,5 @@
1−Left:
1+breakingChanges:
22 AtPath "/test":
33 InOperation PostMethod:
44 InParam "test1": ParamRequired
5+nonBreakingChanges: {}
test/golden/common/pathItem/operation/parameters/required/true/add/report.md+3−3
@@ -1,8 +1,8 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 1 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | 🙆 Non-breaking changes | 🤷 Unsupported feature changes |
4+|------------------------------------------|------------------------|-------------------------------|
5+| 1 | 0 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
test/golden/common/pathItem/operation/parameters/required/true/add/trace-tree.yaml+2−1
@@ -1,3 +1,4 @@
1−Left:
1+breakingChanges:
22 AtPath "/test":
33 InOperation PostMethod: ParamNotMatched "test2"
4+nonBreakingChanges: {}
test/golden/common/pathItem/operation/parameters/required/true/del/report.md+11−1
@@ -1 +1,11 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|---------------------|-------------------------------------------------|-------------------------------|
5+| 0 | 1 | 0 |
6+
7+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
8+
9+## **POST** /test
10+
11+Parameter `test2` is no longer required.
test/golden/common/pathItem/operation/parameters/required/true/del/trace-tree.yaml+4−1
@@ -1 +1,4 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges:
3+ AtPath "/test":
4+ InOperation PostMethod: ParamNotMatched "test2"
test/golden/common/pathItem/operation/requestBody/mediaTypeObject/add/report.md+13−1
@@ -1 +1,13 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|---------------------|-------------------------------------------------|-------------------------------|
5+| 0 | 1 | 0 |
6+
7+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
8+
9+## **POST** /test
10+
11+### Request
12+
13+Media type `application/x-www-form-urlencoded` has been added.
test/golden/common/pathItem/operation/requestBody/mediaTypeObject/add/trace-tree.yaml+5−1
@@ -1 +1,5 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges:
3+ AtPath "/test":
4+ InOperation PostMethod:
5+ InRequest: RequestMediaTypeNotFound application/x-www-form-urlencoded
test/golden/common/pathItem/operation/requestBody/mediaTypeObject/change/report.md+14−4
@@ -1,15 +1,25 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 1 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|------------------------------------------|-------------------------------------------------|-------------------------------|
5+| 1 | 1 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
99## **POST** /test
1010
11−### JSON Request
11+### 📱➡️ JSON Request
1212
1313#### `$(String)`
1414
1515The type has been removed.
16+
17+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
18+
19+## **POST** /test
20+
21+### 📱➡️ JSON Request
22+
23+#### `$(Number)`
24+
25+The type has been added.
test/golden/common/pathItem/operation/requestBody/mediaTypeObject/change/trace-tree.yaml+8−1
@@ -1,7 +1,14 @@
1−Left:
1+breakingChanges:
22 AtPath "/test":
33 InOperation PostMethod:
44 InRequest:
55 InPayload:
66 PayloadSchema:
77 OfType String: NoContradiction
8+nonBreakingChanges:
9+ AtPath "/test":
10+ InOperation PostMethod:
11+ InRequest:
12+ InPayload:
13+ PayloadSchema:
14+ OfType Number: NoContradiction
test/golden/common/pathItem/operation/requestBody/mediaTypeObject/del/report.md+3−3
@@ -1,8 +1,8 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 1 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | 🙆 Non-breaking changes | 🤷 Unsupported feature changes |
4+|------------------------------------------|------------------------|-------------------------------|
5+| 1 | 0 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
test/golden/common/pathItem/operation/requestBody/mediaTypeObject/del/trace-tree.yaml+2−1
@@ -1,4 +1,5 @@
1−Left:
1+breakingChanges:
22 AtPath "/test":
33 InOperation PostMethod:
44 InRequest: RequestMediaTypeNotFound application/x-www-form-urlencoded
5+nonBreakingChanges: {}
test/golden/common/pathItem/operation/requestBody/required/reset/report.md+13−1
@@ -1 +1,13 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|---------------------|-------------------------------------------------|-------------------------------|
5+| 0 | 1 | 0 |
6+
7+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
8+
9+## **POST** /test
10+
11+### Request
12+
13+Request body is no longer required.
test/golden/common/pathItem/operation/requestBody/required/reset/trace-tree.yaml+5−1
@@ -1 +1,5 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges:
3+ AtPath "/test":
4+ InOperation PostMethod:
5+ InRequest: RequestBodyRequired
test/golden/common/pathItem/operation/requestBody/required/set/report.md+3−3
@@ -1,8 +1,8 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 1 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | 🙆 Non-breaking changes | 🤷 Unsupported feature changes |
4+|------------------------------------------|------------------------|-------------------------------|
5+| 1 | 0 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
test/golden/common/pathItem/operation/requestBody/required/set/trace-tree.yaml+2−1
@@ -1,4 +1,5 @@
1−Left:
1+breakingChanges:
22 AtPath "/test":
33 InOperation PostMethod:
44 InRequest: RequestBodyRequired
5+nonBreakingChanges: {}
test/golden/common/pathItem/operation/responses/add/report.md+3−3
@@ -1,8 +1,8 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 1 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | 🙆 Non-breaking changes | 🤷 Unsupported feature changes |
4+|------------------------------------------|------------------------|-------------------------------|
5+| 1 | 0 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
test/golden/common/pathItem/operation/responses/add/trace-tree.yaml+2−1
@@ -1,3 +1,4 @@
1−Left:
1+breakingChanges:
22 AtPath "/test":
33 InOperation PostMethod: ResponseCodeNotFound 500
4+nonBreakingChanges: {}
test/golden/common/pathItem/operation/responses/change/headers/mandatory/add/report.md+13−1
@@ -1 +1,13 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|---------------------|-------------------------------------------------|-------------------------------|
5+| 0 | 1 | 0 |
6+
7+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
8+
9+## **POST** /test
10+
11+### Response code 200
12+
13+New header was added `Test2`.
test/golden/common/pathItem/operation/responses/change/headers/mandatory/add/trace-tree.yaml+5−1
@@ -1 +1,5 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges:
3+ AtPath "/test":
4+ InOperation PostMethod:
5+ WithStatusCode 200: ResponseHeaderMissing "Test2"
test/golden/common/pathItem/operation/responses/change/headers/mandatory/del/report.md+4−4
@@ -1,8 +1,8 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 1 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | 🙆 Non-breaking changes | 🤷 Unsupported feature changes |
4+|------------------------------------------|------------------------|-------------------------------|
5+| 1 | 0 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
@@ -10,4 +10,4 @@
1010
1111### Response code 200
1212
13−New header was added `Test2`.
13+Header was removed `Test2`.
test/golden/common/pathItem/operation/responses/change/headers/mandatory/del/trace-tree.yaml+2−1
@@ -1,4 +1,5 @@
1−Left:
1+breakingChanges:
22 AtPath "/test":
33 InOperation PostMethod:
44 WithStatusCode 200: ResponseHeaderMissing "Test2"
5+nonBreakingChanges: {}
test/golden/common/pathItem/operation/responses/change/headers/optional/add/report.md+5−1
@@ -1 +1,5 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | 🙆 Non-breaking changes | 🤷 Unsupported feature changes |
4+|---------------------|------------------------|-------------------------------|
5+| 0 | 0 | 0 |
test/golden/common/pathItem/operation/responses/change/headers/optional/add/trace-tree.yaml+2−1
@@ -1 +1,2 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges: {}
test/golden/common/pathItem/operation/responses/change/headers/optional/del/report.md+5−1
@@ -1 +1,5 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | 🙆 Non-breaking changes | 🤷 Unsupported feature changes |
4+|---------------------|------------------------|-------------------------------|
5+| 0 | 0 | 0 |
test/golden/common/pathItem/operation/responses/change/headers/optional/del/trace-tree.yaml+2−1
@@ -1 +1,2 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges: {}
test/golden/common/pathItem/operation/responses/change/mediaTypeObject/add/report.md+3−3
@@ -1,8 +1,8 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 1 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | 🙆 Non-breaking changes | 🤷 Unsupported feature changes |
4+|------------------------------------------|------------------------|-------------------------------|
5+| 1 | 0 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
test/golden/common/pathItem/operation/responses/change/mediaTypeObject/add/trace-tree.yaml+2−1
@@ -1,4 +1,5 @@
1−Left:
1+breakingChanges:
22 AtPath "/test":
33 InOperation PostMethod:
44 WithStatusCode 200: ResponseMediaTypeMissing application/x-www-form-urlencoded
5+nonBreakingChanges: {}
test/golden/common/pathItem/operation/responses/change/mediaTypeObject/change/report.md+14−4
@@ -1,15 +1,25 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 1 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|------------------------------------------|-------------------------------------------------|-------------------------------|
5+| 1 | 1 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
99## **POST** /test
1010
11−### JSON Response – 200
11+### 📱⬅️ JSON Response – 200
1212
1313#### `$(Number)`
1414
15+The type has been added.
16+
17+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
18+
19+## **POST** /test
20+
21+### 📱⬅️ JSON Response – 200
22+
23+#### `$(String)`
24+
1525The type has been removed.
test/golden/common/pathItem/operation/responses/change/mediaTypeObject/change/trace-tree.yaml+8−1
@@ -1,7 +1,14 @@
1−Left:
1+breakingChanges:
22 AtPath "/test":
33 InOperation PostMethod:
44 WithStatusCode 200:
55 ResponsePayload:
66 PayloadSchema:
77 OfType Number: NoContradiction
8+nonBreakingChanges:
9+ AtPath "/test":
10+ InOperation PostMethod:
11+ WithStatusCode 200:
12+ ResponsePayload:
13+ PayloadSchema:
14+ OfType String: NoContradiction
test/golden/common/pathItem/operation/responses/change/mediaTypeObject/del/report.md+13−1
@@ -1 +1,13 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|---------------------|-------------------------------------------------|-------------------------------|
5+| 0 | 1 | 0 |
6+
7+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
8+
9+## **POST** /test
10+
11+### Response code 200
12+
13+Media type was removed: `application/x-www-form-urlencoded`.
test/golden/common/pathItem/operation/responses/change/mediaTypeObject/del/trace-tree.yaml+5−1
@@ -1 +1,5 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges:
3+ AtPath "/test":
4+ InOperation PostMethod:
5+ WithStatusCode 200: ResponseMediaTypeMissing application/x-www-form-urlencoded
test/golden/common/pathItem/operation/responses/del/report.md+11−1
@@ -1 +1,11 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|---------------------|-------------------------------------------------|-------------------------------|
5+| 0 | 1 | 0 |
6+
7+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
8+
9+## **POST** /test
10+
11+Reponse code 500 has been removed.
test/golden/common/pathItem/operation/responses/del/trace-tree.yaml+4−1
@@ -1 +1,4 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges:
3+ AtPath "/test":
4+ InOperation PostMethod: ResponseCodeNotFound 500
test/golden/common/property-removed-additional/a.yamlnew file+32
@@ -0,0 +1,32 @@
1+openapi: "3.0.0"
2+info:
3+ version: 1.0.0
4+ title: Test
5+servers:
6+ - url: http://localhost/
7+paths:
8+ /test:
9+ post:
10+ requestBody:
11+ content:
12+ application/json:
13+ schema:
14+ $ref: "#/components/schemas/Test"
15+ responses:
16+ "200":
17+ description: test
18+ content:
19+ application/json:
20+ schema:
21+ $ref: "#/components/schemas/Test"
22+components:
23+ schemas:
24+ Test:
25+ required:
26+ - property1
27+ - property2
28+ properties:
29+ property1:
30+ type: string
31+ property2:
32+ type: number
test/golden/common/property-removed-additional/b.yamlnew file+29
@@ -0,0 +1,29 @@
1+openapi: "3.0.0"
2+info:
3+ version: 1.0.0
4+ title: Test
5+servers:
6+ - url: http://localhost/
7+paths:
8+ /test:
9+ post:
10+ requestBody:
11+ content:
12+ application/json:
13+ schema:
14+ $ref: "#/components/schemas/Test"
15+ responses:
16+ "200":
17+ description: test
18+ content:
19+ application/json:
20+ schema:
21+ $ref: "#/components/schemas/Test"
22+components:
23+ schemas:
24+ Test:
25+ required:
26+ - property1
27+ properties:
28+ property1:
29+ type: string
test/golden/common/property-removed-additional/report.mdnew file+25
@@ -0,0 +1,25 @@
1+# Summary
2+
3+| [⚠️ Breaking changes](#breaking-changes) | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|------------------------------------------|-------------------------------------------------|-------------------------------|
5+| 1 | 1 | 0 |
6+
7+# <span id="breaking-changes"></span>⚠️ Breaking changes
8+
9+## **POST** /test
10+
11+### 📱⬅️ JSON Response – 200
12+
13+#### `$(Object)`
14+
15+Property `property2` may not be present.
16+
17+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
18+
19+## **POST** /test
20+
21+### 📱➡️ JSON Request
22+
23+#### `$(Object)`
24+
25+Property `property2` may not be present.
test/golden/common/property-removed-additional/trace-tree.yamlnew file+14
@@ -0,0 +1,14 @@
1+breakingChanges:
2+ AtPath "/test":
3+ InOperation PostMethod:
4+ WithStatusCode 200:
5+ ResponsePayload:
6+ PayloadSchema:
7+ OfType Object: PropertyNowRequired "property2"
8+nonBreakingChanges:
9+ AtPath "/test":
10+ InOperation PostMethod:
11+ InRequest:
12+ InPayload:
13+ PayloadSchema:
14+ OfType Object: PropertyNowRequired "property2"
test/golden/common/property-removed/report.md+22−6
@@ -1,21 +1,37 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 2 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|------------------------------------------|-------------------------------------------------|-------------------------------|
5+| 2 | 2 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
99## **POST** /test
1010
11−### JSON Request
11+### 📱➡️ JSON Request
1212
1313#### `$(Object)`
1414
1515Property `property2` has been removed.
1616
17−### JSON Response – 200
17+### 📱⬅️ JSON Response – 200
1818
1919#### `$(Object)`
2020
21−Property `property2` has become required.
21+Property `property2` may not be present.
22+
23+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
24+
25+## **POST** /test
26+
27+### 📱➡️ JSON Request
28+
29+#### `$(Object)`
30+
31+Property `property2` may not be present.
32+
33+### 📱⬅️ JSON Response – 200
34+
35+#### `$(Object)`
36+
37+Property `property2` has been removed.
test/golden/common/property-removed/trace-tree.yaml+12−1
@@ -1,4 +1,4 @@
1−Left:
1+breakingChanges:
22 AtPath "/test":
33 InOperation PostMethod:
44 InRequest:
@@ -9,3 +9,14 @@ Left:
99 ResponsePayload:
1010 PayloadSchema:
1111 OfType Object: PropertyNowRequired "property2"
12+nonBreakingChanges:
13+ AtPath "/test":
14+ InOperation PostMethod:
15+ InRequest:
16+ InPayload:
17+ PayloadSchema:
18+ OfType Object: PropertyNowRequired "property2"
19+ WithStatusCode 200:
20+ ResponsePayload:
21+ PayloadSchema:
22+ OfType Object: UnexpectedProperty "property2"
test/golden/common/property-required/report.md+14−4
@@ -1,14 +1,24 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 1 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|------------------------------------------|-------------------------------------------------|-------------------------------|
5+| 1 | 1 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
99## **POST** /test
1010
11−### JSON Request
11+### 📱➡️ JSON Request
12+
13+#### `$(Object)`
14+
15+Property `property2` has become required.
16+
17+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
18+
19+## **POST** /test
20+
21+### 📱⬅️ JSON Response – 200
1222
1323#### `$(Object)`
1424
test/golden/common/property-required/trace-tree.yaml+8−1
@@ -1,7 +1,14 @@
1−Left:
1+breakingChanges:
22 AtPath "/test":
33 InOperation PostMethod:
44 InRequest:
55 InPayload:
66 PayloadSchema:
77 OfType Object: PropertyNowRequired "property2"
8+nonBreakingChanges:
9+ AtPath "/test":
10+ InOperation PostMethod:
11+ WithStatusCode 200:
12+ ResponsePayload:
13+ PayloadSchema:
14+ OfType Object: PropertyNowRequired "property2"
test/golden/common/recursive/report.md+19−1
@@ -1 +1,19 @@
1−# No breaking changes found ✨
1+# Summary
2+
3+| ⚠️ Breaking changes | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|---------------------|-------------------------------------------------|-------------------------------|
5+| 0 | 1 | 0 |
6+
7+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
8+
9+## **GET** /api/foo
10+
11+### 📱⬅️ JSON Response – 200
12+
13+#### `$.leaf.value.foo(String)`
14+
15+The following enum value has been removed:
16+
17+``` json
18+"a"
19+```
test/golden/common/recursive/trace-tree.yaml+14−1
@@ -1 +1,14 @@
1−Right: []
1+breakingChanges: {}
2+nonBreakingChanges:
3+ AtPath "/api/foo":
4+ InOperation GetMethod:
5+ WithStatusCode 200:
6+ ResponsePayload:
7+ PayloadSchema:
8+ OfType Object:
9+ InProperty "leaf":
10+ OfType Object:
11+ InProperty "value":
12+ OfType Object:
13+ InProperty "foo":
14+ OfType String: NoMatchingEnum (String "a")
test/golden/common/security-scheme/report.md+13−3
@@ -1,8 +1,8 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 2 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|------------------------------------------|-------------------------------------------------|-------------------------------|
5+| 2 | 1 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
@@ -21,3 +21,13 @@ Security scheme has been removed.
2121#### oauth
2222
2323Security scheme has been removed.
24+
25+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
26+
27+## **POST** /oauth/check
28+
29+### Security requirement 0
30+
31+#### spa-oauth
32+
33+Security scheme has been added.
test/golden/common/security-scheme/trace-tree.yaml+6−1
@@ -1,4 +1,4 @@
1−Left:
1+breakingChanges:
22 AtPath "/oauth/sign_out":
33 InOperation GetMethod:
44 SecurityRequirementStep 1:
@@ -7,3 +7,8 @@ Left:
77 InOperation PostMethod:
88 SecurityRequirementStep 0:
99 SecuritySchemeStep "oauth": SecuritySchemeNotMatched
10+nonBreakingChanges:
11+ AtPath "/oauth/check":
12+ InOperation PostMethod:
13+ SecurityRequirementStep 0:
14+ SecuritySchemeStep "spa-oauth": SecuritySchemeNotMatched
test/golden/common/servers/report.md+11−3
@@ -1,8 +1,8 @@
11# Summary
22
3−| [⚠️ Breaking changes](#breaking-changes) | 🤷 Unsupported feature changes |
4−|------------------------------------------|-------------------------------|
5−| 3 | 0 |
3+| [⚠️ Breaking changes](#breaking-changes) | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
4+|------------------------------------------|-------------------------------------------------|-------------------------------|
5+| 3 | 1 | 0 |
66
77# <span id="breaking-changes"></span>⚠️ Breaking changes
88
@@ -17,3 +17,11 @@ The server was removed.
1717Enum value `a` has been removed.
1818
1919A variable has been changed from being open to being closed.
20+
21+# <span id="non-breaking-changes"></span>🙆 Non-breaking changes
22+
23+## **GET** /pets
24+
25+### Server `http://{x}variable.path/{y}/{openVariable1}/{openVariable2}`
26+
27+Enum value `bbb` has been added.
test/golden/common/servers/trace-tree.yaml+6−1
@@ -1,7 +1,12 @@
1−Left:
1+breakingChanges:
22 AtPath "/pets":
33 InOperation GetMethod:
44 InServer "http://{x}variable.path/{y}/{openVariable1}/{openVariable2}":
55 - EnumValueNotConsumed 1 "a"
66 - ConsumerNotOpen 7
77 InServer "http://missing.url": ServerNotMatched
8+nonBreakingChanges:
9+ AtPath "/pets":
10+ InOperation GetMethod:
11+ InServer "http://{x}variable.path/{y}/{openVariable1}/{openVariable2}": EnumValueNotConsumed
12+ 3 "bbb"
test/golden/common/unguarded-recursive/report.md+4−4
@@ -1,13 +1,13 @@
11# Summary
22
3−| ⚠️ Breaking changes | [🤷 Unsupported feature changes](#unsupported-changes) |
4−|---------------------|-------------------------------------------------------|
5−| 0 | 1 |
3+| ⚠️ Breaking changes | 🙆 Non-breaking changes | [🤷 Unsupported feature changes](#unsupported-changes) |
4+|---------------------|------------------------|-------------------------------------------------------|
5+| 0 | 0 | 1 |
66
77# <span id="unsupported-changes"></span>🤷 Unsupported feature changes
88
99## **GET** /api/foo
1010
11−### JSON Response – 200
11+### 📱⬅️ JSON Response – 200
1212
1313Encountered recursion that is too complex for OpenApi Diff to untangle.
test/golden/common/unguarded-recursive/trace-tree.yaml+7−1
@@ -1,4 +1,10 @@
1−Left:
1+breakingChanges:
2+ AtPath "/api/foo":
3+ InOperation GetMethod:
4+ WithStatusCode 200:
5+ ResponsePayload:
6+ PayloadSchema: UnguardedRecursion
7+nonBreakingChanges:
28 AtPath "/api/foo":
39 InOperation GetMethod:
410 WithStatusCode 200: