@@ -68,17 +68,14 @@ import Helpers
6868 , setPropertyNameInJsonValue
6969 )
7070import Validation
71+ import JsonValue exposing (JsonValue (ObjectValue, ArrayValue))
7172import Json.Schema.Definitions as Schema
7273 exposing
7374 ( Schema ( BooleanSchema , ObjectSchema )
7475 , SubSchema
7576 , Schemata ( Schemata )
7677 , Type ( AnyType , SingleType , NullableType , UnionType )
7778 , SingleType ( IntegerType , NumberType , StringType , BooleanType )
78- , JsonValue ( ObjectValue , ArrayValue , BooleanValue , NullValue , NumericValue , StringValue )
79- , jsonValueDecoder
80- , encodeJsonValue
81- , blankSchema
8279 )
8380import EditableJsonValue
8481 exposing
@@ -139,7 +136,7 @@ init schema val =
139136 let
140137 jsonValue =
141138 val
142- |> Decode . decodeValue jsonValueDecoder
139+ |> Decode . decodeValue JsonValue . decoder
143140 |> Result . withDefault ( ObjectValue [] )
144141
145142 editableJsonValue =
@@ -169,7 +166,7 @@ makeValidSchema jsonValue schema =
169166 let
170167 val =
171168 jsonValue
172- |> encodeJsonValue
169+ |> JsonValue . encode
173170 in
174171 schema
175172 |> Validation . validate val
@@ -180,7 +177,7 @@ makeValidSchema jsonValue schema =
180177getValue : Model -> Value
181178getValue model =
182179 model. jsonValue
183- |> encodeJsonValue
180+ |> JsonValue . encode
184181
185182
186183updateValue : Model -> String -> Result String EditableJsonValue -> ( Model , ExternalMsg )
@@ -256,7 +253,7 @@ update msg model =
256253 |> getJsonValue ( parseJsonPointer jsonPointer)
257254 |> Result . withDefault model. editableJsonValue
258255 |> EditableJsonValue . makeJsonValue
259- |> encodeJsonValue
256+ |> JsonValue . encode
260257 |> Encode . encode 4
261258 }
262259 , Select id
@@ -274,7 +271,7 @@ update msg model =
274271 -}
275272 ValueChange path str ->
276273 str
277- |> decodeString jsonValueDecoder
274+ |> decodeString JsonValue . decoder
278275 |> Result . map EditableJsonValue . makeEditableJsonValue
279276 |> updateValue { model | editValue = str, editPath = path } path
280277
@@ -356,7 +353,7 @@ update msg model =
356353 ( { model
357354 | jsonValue =
358355 s
359- |> Decode . decodeValue jsonValueDecoder
356+ |> Decode . decodeValue JsonValue . decoder
360357 |> Result . withDefault ( ObjectValue [] )
361358 }
362359 , NoOp
0 commit comments