dhall-openapi 1.0.6 → 1.0.7
raw patch · 2 files changed
+30/−31 lines, 2 filesdep ~basedep ~containersdep ~optparse-applicative
Dependency ranges changed: base, containers, optparse-applicative
Files
- dhall-openapi.cabal +17/−17
- openapi-to-dhall/Main.hs +13/−14
dhall-openapi.cabal view
@@ -1,6 +1,6 @@ Cabal-Version: 1.11 Name: dhall-openapi-Version: 1.0.6+Version: 1.0.7 Homepage: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-openapi#dhall-openapi Author: Fabrizio Ferrai Maintainer: GenuineGabriella@gmail.com@@ -36,20 +36,20 @@ TupleSections Ghc-Options: -Wall Build-Depends:- base ,- aeson ,- containers ,- directory >= 1.3.0.0 && < 1.4 ,- dhall ,- dhall-openapi ,- filepath >= 1.4 && < 1.5 ,+ base >= 4.11.0.0 && < 5 ,+ aeson ,+ containers ,+ directory >= 1.3.0.0 && < 1.4 ,+ dhall ,+ dhall-openapi ,+ filepath >= 1.4 && < 1.6 , -- megaparsec follows SemVer: https://github.com/mrkkrp/megaparsec/issues/469#issuecomment-927918469- megaparsec >= 7.0 && < 10 ,- optparse-applicative >= 0.14.3.0 && < 0.18 ,- parser-combinators , - prettyprinter ,- sort ,- text ,+ megaparsec >= 7.0 && < 10 ,+ optparse-applicative >= 0.14.3.0 && < 0.19,+ parser-combinators ,+ prettyprinter ,+ sort ,+ text , vector Default-Language: Haskell2010 @@ -77,12 +77,12 @@ Ghc-Options: -Wall Build-Depends: base >= 4.11.0.0 && < 5 ,- aeson >= 1.0.0.0 && < 2.2 ,- containers >= 0.5.8.0 && < 0.7 ,+ aeson >= 1.0.0.0 && < 2.3 ,+ containers >= 0.5.8.0 && < 0.8 , dhall >= 1.38.0 && < 1.43 , prettyprinter >= 1.7.0 && < 1.8 , scientific >= 0.3.0.0 && < 0.4 , sort >= 1.0 && < 1.1 ,- text >= 0.11.1.0 && < 2.1 ,+ text >= 0.11.1.0 && < 2.2 , vector >= 0.11.0.0 && < 0.14 Default-Language: Haskell2010
openapi-to-dhall/Main.hs view
@@ -144,29 +144,28 @@ Right version -> Just version -- https://github.com/dhall-lang/dhall-kubernetes/issues/112-data Autoscaling = AutoscalingV1 | AutoscalingV2beta1 | AutoscalingV2beta2- deriving (Eq, Ord)--getAutoscaling :: ModelName -> Maybe Autoscaling-getAutoscaling ModelName{..}- | Text.isPrefixOf "io.k8s.api.autoscaling.v1" unModelName =- Just AutoscalingV1- | Text.isPrefixOf "io.k8s.api.autoscaling.v2beta1" unModelName =- Just AutoscalingV2beta1- | Text.isPrefixOf "io.k8s.api.autoscaling.v2beta2" unModelName =- Just AutoscalingV2beta2+-- https://github.com/dhall-lang/dhall-kubernetes/issues/191+comparingAutoscaling :: ModelName -> ModelName -> Ordering+comparingAutoscaling modelNameL modelNameR+ | isAutoscaling modelNameL && isAutoscaling modelNameR =+ case (getVersion modelNameL, getVersion modelNameR) of+ (Just (Version Production 1), Just (Version (Beta _) 2)) -> LT+ (Just (Version (Beta _) 2), Just (Version Production 1)) -> GT+ _ -> mempty | otherwise =- Nothing+ mempty+ where+ isAutoscaling ModelName{..} =+ Text.isPrefixOf "io.k8s.api.autoscaling." unModelName isK8sNative :: ModelName -> Bool isK8sNative ModelName{..} = Text.isPrefixOf "io.k8s." unModelName preferStableResource :: DuplicateHandler preferStableResource (_, names) = do- let issue112 = Ord.comparing getAutoscaling let k8sOverCrd = Ord.comparing isK8sNative let defaultComparison = Ord.comparing getVersion- let comparison = issue112 <> k8sOverCrd <> defaultComparison+ let comparison = comparingAutoscaling <> k8sOverCrd <> defaultComparison return (List.maximumBy comparison names) skipDuplicatesHandler :: DuplicateHandler