Skip to content

Doesn't work on V 0.4.10 #1

@nekoedges

Description

@nekoedges

Error:

/home/edges/.vmodules/openapi/parameter.v:17:29: error: The generic symbol `<>` is obsolete, please replace it with `[]`
   15 |     explode           bool
   16 |     allow_reserved    bool
   17 |     schema            ObjectRef<Schema>
      |                                ^
   18 |     example           Any
   19 |     examples          map[string]ObjectRef<Example>

So, I replaced all of <*> with [*] and now I get this error:

/home/edges/.vmodules/openapi/callback.v:8:42: error: duplicate of an import symbol `json`
    6 | pub type Callback = map[string]PathItem
    7 | 
    8 | pub fn (mut callback Callback) from_json(json Any) ? {
      |                                          ~~~~
    9 |     mut tmp := map[string]PathItem{}
   10 |     for key, value in json.as_map() {
/home/edges/.vmodules/openapi/components.v:19:46: error: duplicate of an import symbol `json`
   17 | }
   18 | 
   19 | pub fn (mut components Components) from_json(json Any) ? {
      |                                              ~~~~
   20 |     for key, value in json.as_map() {
   21 |         match key {
/home/edges/.vmodules/openapi/components.v:63:4: error: Option and Result types have been split, use `!Foo` to return errors
   61 |     keys.map(fn (key string) ? {
   62 |         if !check_key_regex(key) {
   63 |             return error('Failed Components Decoding: $key do not respect key regex format.')
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   64 |         }
   65 |     })
/home/edges/.vmodules/openapi/components.v:61:11: error: option needs to be unwrapped before using it in map/filter
   59 | 
   60 | fn check_keys(keys []string) ? {
   61 |     keys.map(fn (key string) ? {
      |              ~~~~~~~~~~~~~~~~~~~
   62 |         if !check_key_regex(key) {
   63 |             return error('Failed Components Decoding: $key do not respect key regex format.')
/home/edges/.vmodules/openapi/example.v:14:40: error: duplicate of an import symbol `json`
   12 | }
   13 | 
   14 | pub fn (mut example Example) from_json(json Any) ? {
      |                                        ~~~~
   15 |     object := json.as_map()
   16 |
/home/edges/.vmodules/openapi/example.v:18:3: error: Option and Result types have been split, use `!Foo` to return errors
   16 | 
   17 |     if 'value' in object && 'externalValue' in object {
   18 |         return error('Failed Example decoding: "value" and "externalValue" are mutually exclusive')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   19 |     }
   20 |
/home/edges/.vmodules/openapi/header.v:10:38: error: duplicate of an import symbol `json`
    8 | }
    9 | 
   10 | pub fn (mut header Header) from_json(json Any) ? {
      |                                      ~~~~
   11 |     object := json.as_map()
   12 |     for key, value in object {
/home/edges/.vmodules/openapi/header.v:34:3: error: Option and Result types have been split, use `!Foo` to return errors
   32 | fn (mut header Header) validate(object map[string]Any) ? {
   33 |     if 'name' in object || 'in' in object {
   34 |         return error('Failed Header decoding: "name" and "in" must not be specified.')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   35 |     }
   36 |
/home/edges/.vmodules/openapi/header.v:38:3: error: Option and Result types have been split, use `!Foo` to return errors
   36 | 
   37 |     if 'example' in object && 'examples' in object {
   38 |         return error('Failed Header decoding: "example" and "examples" are mutually exclusives')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   39 |     }
   40 |
/home/edges/.vmodules/openapi/header.v:50:3: error: Option and Result types have been split, use `!Foo` to return errors
   48 | 
   49 |     if header.content.len > 1 {
   50 |         return error('Failed Header decoding: "content" must contain only one entry.')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   51 |     }
   52 | }
/home/edges/.vmodules/openapi/helpers.v:27:25: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
   25 | 
   26 | pub fn decode_array_string(src string) ?[]string {
   27 |     json := raw_decode(src)?
      |                            ^
   28 |     return json.arr().map(fn (elt Any) string {
   29 |         return elt.str()
/home/edges/.vmodules/openapi/helpers.v:27:2: error: duplicate of an import symbol `json`
   25 | 
   26 | pub fn decode_array_string(src string) ?[]string {
   27 |     json := raw_decode(src)?
      |     ~~~~
   28 |     return json.arr().map(fn (elt Any) string {
   29 |         return elt.str()
/home/edges/.vmodules/openapi/helpers.v:34:25: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
   32 | 
   33 | pub fn decode_array_any(src string) ?[]Any {
   34 |     json := raw_decode(src)?
      |                            ^
   35 |     return json.arr().map(fn (elt Any) Any {
   36 |         return elt
/home/edges/.vmodules/openapi/helpers.v:34:2: error: duplicate of an import symbol `json`
   32 | 
   33 | pub fn decode_array_any(src string) ?[]Any {
   34 |     json := raw_decode(src)?
      |     ~~~~
   35 |     return json.arr().map(fn (elt Any) Any {
   36 |         return elt
/home/edges/.vmodules/openapi/helpers.v:53:25: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
   51 | 
   52 | pub fn decode_map_string(src string) ?map[string]string {
   53 |     json := raw_decode(src)?
      |                            ^
   54 |     mut typ := map[string]string{}
   55 |
/home/edges/.vmodules/openapi/helpers.v:53:2: error: duplicate of an import symbol `json`
   51 | 
   52 | pub fn decode_map_string(src string) ?map[string]string {
   53 |     json := raw_decode(src)?
      |     ~~~~
   54 |     mut typ := map[string]string{}
   55 |
/home/edges/.vmodules/openapi/helpers.v:63:25: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
   61 | 
   62 | pub fn decode_map_any(src string) ?map[string]Any {
   63 |     json := raw_decode(src)?
      |                            ^
   64 |     mut typ := map[string]Any{}
   65 |
/home/edges/.vmodules/openapi/helpers.v:63:2: error: duplicate of an import symbol `json`
   61 | 
   62 | pub fn decode_map_any(src string) ?map[string]Any {
   63 |     json := raw_decode(src)?
      |     ~~~~
   64 |     mut typ := map[string]Any{}
   65 |
/home/edges/.vmodules/openapi/info.v:16:34: error: duplicate of an import symbol `json`
   14 | }
   15 | 
   16 | pub fn (mut info Info) from_json(json Any) ? {
      |                                  ~~~~
   17 |     object := json.as_map()
   18 |     check_required[Info](object, 'title', 'version')?
/home/edges/.vmodules/openapi/info.v:45:3: error: Option and Result types have been split, use `!Foo` to return errors
   43 | 
   44 |     if info.terms_of_service != '' && !check_url_regex(info.terms_of_service) {
   45 |         return error('Failed Info decoding: "termsOfService" do not match url regex expression')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   46 |     }
   47 | }
/home/edges/.vmodules/openapi/info.v:58:40: error: duplicate of an import symbol `json`
   56 | }
   57 | 
   58 | pub fn (mut contact Contact) from_json(json Any) ? {
      |                                        ~~~~
   59 |     for key, value in json.as_map() {
   60 |         match key {
/home/edges/.vmodules/openapi/info.v:69:3: error: Option and Result types have been split, use `!Foo` to return errors
   67 | 
   68 |     if contact.url != '' && !check_url_regex(contact.url) {
   69 |         return error('Failed Contact decoding: "url" do not match url regex expression')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   70 |     }
   71 |
/home/edges/.vmodules/openapi/info.v:73:3: error: Option and Result types have been split, use `!Foo` to return errors
   71 | 
   72 |     if contact.email != '' && !check_email_regex(contact.email) {
   73 |         return error('Failed Contact decoding: "email" do not match email regex expression')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   74 |     }
   75 | }
/home/edges/.vmodules/openapi/info.v:85:40: error: duplicate of an import symbol `json`
   83 | }
   84 | 
   85 | pub fn (mut license License) from_json(json Any) ? {
      |                                        ~~~~
   86 |     object := json.as_map()
   87 |     check_required[License](object, 'name')?
/home/edges/.vmodules/openapi/info.v:98:3: error: Option and Result types have been split, use `!Foo` to return errors
   96 | 
   97 |     if license.url != '' && !check_url_regex(license.url) {
   98 |         return error('Failed License decoding: "url" do not match url regex expression')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   99 |     }
  100 | }
/home/edges/.vmodules/openapi/link.v:16:34: error: duplicate of an import symbol `json`
   14 | }
   15 | 
   16 | pub fn (mut link Link) from_json(json Any) ? {
      |                                  ~~~~
   17 |     for key, value in json.as_map() {
   18 |         match key {
/home/edges/.vmodules/openapi/link.v:42:3: error: Option and Result types have been split, use `!Foo` to return errors
   40 | 
   41 |     if link.operation_ref != '' && link.operation_id != '' {
   42 |         return error('Failed Link decoding: "operationId" and "operationRef" are mutually exclusives')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   43 |     }
   44 | }
/home/edges/.vmodules/openapi/media_type.v:14:45: error: duplicate of an import symbol `json`
   12 | }
   13 | 
   14 | pub fn (mut media_type MediaType) from_json(json Any) ? {
      |                                             ~~~~
   15 |     object := json.as_map()
   16 |
/home/edges/.vmodules/openapi/media_type.v:18:3: error: Option and Result types have been split, use `!Foo` to return errors
   16 | 
   17 |     if 'example' in object && 'examples' in object {
   18 |         return error('Failed MediaType decoding: "example" and "examples" are mutually exclusives')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   19 |     }
   20 |
/home/edges/.vmodules/openapi/media_type.v:51:42: error: duplicate of an import symbol `json`
   49 | }
   50 | 
   51 | pub fn (mut encoding Encoding) from_json(json Any) ? {
      |                                          ~~~~
   52 |     object := json.as_map()
   53 |     for key, value in object {
/home/edges/.vmodules/openapi/openapi.v:18:41: error: duplicate of an import symbol `json`
   16 | }
   17 | 
   18 | pub fn (mut open_api OpenApi) from_json(json Any) ? {
      |                                         ~~~~
   19 |     object := json.as_map()
   20 |     check_required[OpenApi](object, 'openapi', 'info', 'paths')?
/home/edges/.vmodules/openapi/openapi.v:57:3: error: Option and Result types have been split, use `!Foo` to return errors
   55 | fn (open_api OpenApi) validate() ? {
   56 |     if !open_api.openapi.starts_with('3') {
   57 |         return error('Failed OpenApi decoding: can only decode OpenAPi version 3')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   58 |     }
   59 | }
/home/edges/.vmodules/openapi/operation.v:22:44: error: duplicate of an import symbol `json`
   20 | }
   21 | 
   22 | pub fn (mut operation Operation) from_json(json Any) ? {
      |                                            ~~~~
   23 |     object := json.as_map()
   24 |     check_required[Operation](object, 'responses')?
/home/edges/.vmodules/openapi/operation.v:78:4: error: Option and Result types have been split, use `!Foo` to return errors
   76 |         param := parameter as Parameter
   77 |         if param.name in checked && checked[param.name] == param.location {
   78 |             return error('Failed Operation decoding: parameter with identical "name" and "in" found.')
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   79 |         }
   80 |         checked[param.name] = param.location
/home/edges/.vmodules/openapi/operation.v:116:59: error: duplicate of an import symbol `json`
  114 | }
  115 | 
  116 | pub fn (mut external_doc ExternalDocumentation) from_json(json Any) ? {
      |                                                           ~~~~
  117 |     object := json.as_map()
  118 |     check_required[ExternalDocumentation](object, 'url')?
/home/edges/.vmodules/openapi/operation.v:133:3: error: Option and Result types have been split, use `!Foo` to return errors
  131 | 
  132 |     if external_doc.url != '' && !check_email_regex(external_doc.url) {
  133 |         return error('Failed ExternalDocumentation decoding: "url" do not match url regex expression.')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  134 |     }
  135 | }
/home/edges/.vmodules/openapi/parameter.v:23:44: error: duplicate of an import symbol `json`
   21 | }
   22 | 
   23 | pub fn (mut parameter Parameter) from_json(json Any) ? {
      |                                            ~~~~
   24 |     object := json.as_map()
   25 |
/home/edges/.vmodules/openapi/parameter.v:77:3: error: Option and Result types have been split, use `!Foo` to return errors
   75 | 
   76 |     if 'example' in object && 'examples' in object {
   77 |         return error('Failed Parameter decoding: "example" and "examples" are mutually exclusives')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   78 |     }
   79 |
/home/edges/.vmodules/openapi/parameter.v:90:5: error: Option and Result types have been split, use `!Foo` to return errors
   88 |         'path' {
   89 |             if !parameter.required {
   90 |                 return error('Failed Parameter decoding: "required" must be true in this case.')
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   91 |             }
   92 |             default_style = 'simple'
/home/edges/.vmodules/openapi/parameter.v:98:4: error: Option and Result types have been split, use `!Foo` to return errors
   96 |         }
   97 |         else {
   98 |             return error('Failed Parameter decoding: "in" value not valid.')
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   99 |         }
  100 |     }
/home/edges/.vmodules/openapi/parameter.v:111:3: error: Option and Result types have been split, use `!Foo` to return errors
  109 | 
  110 |     if parameter.content.len > 1 {
  111 |         return error('Failed Parameter decoding: "content" must contain only one entry.')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  112 |     }
  113 | }
/home/edges/.vmodules/openapi/path_item.v:24:43: error: duplicate of an import symbol `json`
   22 | }
   23 | 
   24 | pub fn (mut path_item PathItem) from_json(json Any) ? {
      |                                           ~~~~
   25 |     object := json.as_map()
   26 |     for key, value in object {
/home/edges/.vmodules/openapi/path_item.v:81:4: error: Option and Result types have been split, use `!Foo` to return errors
   79 |         param := parameter as Parameter
   80 |         if param.name in checked && checked[param.name] == param.location {
   81 |             return error('Failed Path_item decoding: parameter with identical "name" and "in" found.')
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   82 |         }
   83 |         checked[param.name] = param.location
/home/edges/.vmodules/openapi/path_item.v:126:36: error: duplicate of an import symbol `json`
  124 | }
  125 | 
  126 | pub fn (mut paths Paths) from_json(json Any) ? {
      |                                    ~~~~
  127 |     mut save_value := map[string][]string{}
  128 |     mut tmp := map[string]PathItem{}
/home/edges/.vmodules/openapi/path_item.v:132:4: error: Option and Result types have been split, use `!Foo` to return errors
  130 |     for key, value in json.as_map() {
  131 |         if !key.starts_with('/') {
  132 |             return error('Failed Paths decoding: path do not start with "/" !')
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  133 |         }
  134 |
/home/edges/.vmodules/openapi/path_item.v:151:6: error: Option and Result types have been split, use `!Foo` to return errors
  149 | 
  150 |                 if verif {
  151 |                     return error('Failed Paths decoding: Identical path found !')
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  152 |                 }
  153 |             }
/home/edges/.vmodules/openapi/reference.v:11:44: error: duplicate of an import symbol `json`
    9 | }
   10 | 
   11 | pub fn (mut reference Reference) from_json(json Any) ? {
      |                                            ~~~~
   12 |     object := json.as_map()
   13 |     check_required[Reference](object, '\$ref')?
/home/edges/.vmodules/openapi/reference.v:40:54: error: duplicate of an import symbol `json`
   38 | // ---------------------------------------- //
   39 | 
   40 | pub fn (mut object []ObjectRef[Parameter]) from_json(json Any) ? {
      |                                                      ~~~~
   41 |     for value in json.arr() {
   42 |         str := raw_decode(value.json_str())?
/home/edges/.vmodules/openapi/reference.v:42:38: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
   40 | pub fn (mut object []ObjectRef[Parameter]) from_json(json Any) ? {
   41 |     for value in json.arr() {
   42 |         str := raw_decode(value.json_str())?
      |                                            ^
   43 |         object << from_json[Parameter](str)?
   44 |     }
/home/edges/.vmodules/openapi/request_body.v:13:49: error: duplicate of an import symbol `json`
   11 | }
   12 | 
   13 | pub fn (mut request_body RequestBody) from_json(json Any) ? {
      |                                                 ~~~~
   14 |     object := json.as_map()
   15 |     check_required[RequestBody](object, 'content')?
/home/edges/.vmodules/openapi/responses.v:8:44: error: duplicate of an import symbol `json`
    6 | pub type Responses = map[string]ObjectRef[Response]
    7 | 
    8 | pub fn (mut responses Responses) from_json(json Any) ? {
      |                                            ~~~~
    9 |     if json.str() == '' {
   10 |         return
/home/edges/.vmodules/openapi/responses.v:18:4: error: Option and Result types have been split, use `!Foo` to return errors
   16 |             tmp[key] = from_json[Response](value)?
   17 |         } else {
   18 |             return error('Failed Responses decoding: invalid http code value $key')
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   19 |         }
   20 |     }
/home/edges/.vmodules/openapi/responses.v:34:42: error: duplicate of an import symbol `json`
   32 | }
   33 | 
   34 | pub fn (mut response Response) from_json(json Any) ? {
      |                                          ~~~~
   35 |     object := json.as_map()
   36 |     check_required[Response](object, 'description')?
/home/edges/.vmodules/openapi/responses.v:62:4: error: Option and Result types have been split, use `!Foo` to return errors
   60 |     for key in response.links.keys() {
   61 |         if !check_key_regex(key) {
   62 |             return error('Failed Response decoding: "links" key do not comply with the format.')
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   63 |         }
   64 |     }
/home/edges/.vmodules/openapi/schema.v:48:38: error: duplicate of an import symbol `json`
   46 | }
   47 | 
   48 | pub fn (mut schema Schema) from_json(json Any) ? {
      |                                      ~~~~
   49 |     object := json.as_map()
   50 |     for key, value in object {
/home/edges/.vmodules/openapi/schema.v:165:3: error: Option and Result types have been split, use `!Foo` to return errors
  163 | fn (mut schema Schema) validate(object map[string]Any) ? {
  164 |     if 'readOnly' in object && 'writeOnly' in object {
  165 |         return error('Failed Schema decoding: Schema cannot be writeOnly and readOnly')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  166 |     }
  167 |
/home/edges/.vmodules/openapi/schema.v:176:5: error: Option and Result types have been split, use `!Foo` to return errors
  174 |             if 'items' !in object {
  175 |                 println(schema.items)
  176 |                 return error('Failed Schema decoding: "items" must be non-null if "type" is "array"')
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  177 |             }
  178 |         }
/home/edges/.vmodules/openapi/schema.v:192:6: error: Option and Result types have been split, use `!Foo` to return errors
  190 |             if schema.pattern != '' {
  191 |                 regex.regex_opt(schema.pattern) or {
  192 |                     return error('Failed Schema decoding: invalid pattern regex $schema.pattern')
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  193 |                 }
  194 |             }
/home/edges/.vmodules/openapi/schema.v:198:5: error: Option and Result types have been split, use `!Foo` to return errors
  196 |         'null' {
  197 |             if !schema.nullable {
  198 |                 return error('Failed Schema decoding: "nullable" must be true to have a null "type"')
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  199 |             }
  200 |         }
/home/edges/.vmodules/openapi/schema.v:202:4: error: Option and Result types have been split, use `!Foo` to return errors
  200 |         }
  201 |         else {
  202 |             return error('Failed Schema decoding: unsupported type $schema.type_schema')
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  203 |         }
  204 |     }
/home/edges/.vmodules/openapi/schema.v:207:3: error: Option and Result types have been split, use `!Foo` to return errors
  205 | 
  206 |     if schema.format != '' && format_values.len != 0 && schema.format !in format_values {
  207 |         return error('Failed Schema decoding: unsupported format value $schema.format')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  208 |     }
  209 | }
/home/edges/.vmodules/openapi/schema.v:219:52: error: duplicate of an import symbol `json`
  217 | }
  218 | 
  219 | pub fn (mut discriminator Discriminator) from_json(json Any) ? {
      |                                                    ~~~~
  220 |     object := json.as_map()
  221 |     check_required[Discriminator](object, 'propertyName')?
/home/edges/.vmodules/openapi/schema.v:247:32: error: duplicate of an import symbol `json`
  245 | }
  246 | 
  247 | pub fn (mut xml XML) from_json(json Any) ? {
      |                                ~~~~
  248 |     for key, value in json.as_map() {
  249 |         match key {
/home/edges/.vmodules/openapi/security.v:8:56: error: duplicate of an import symbol `json`
    6 | pub type SecurityRequirement = map[string][]string
    7 | 
    8 | pub fn (mut requirement SecurityRequirement) from_json(json Any) ? {
      |                                                        ~~~~
    9 |     mut tmp := map[string][]string{}
   10 |     for key, value in json.as_map() {
/home/edges/.vmodules/openapi/security.v:31:55: error: duplicate of an import symbol `json`
   29 | }
   30 | 
   31 | pub fn (mut security_scheme SecurityScheme) from_json(json Any) ? {
      |                                                       ~~~~
   32 |     object := json.as_map()
   33 |     for key, value in json.as_map() {
/home/edges/.vmodules/openapi/security.v:72:5: error: Option and Result types have been split, use `!Foo` to return errors
   70 |             check_required[SecurityScheme](object, 'name', 'in')?
   71 |             if security_scheme.location !in ['query', 'header', 'cookie'] {
   72 |                 return error('Failed SecurityScheme decoding: "in" is not valid $security_scheme.location')
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 |             }
   74 |         }
/home/edges/.vmodules/openapi/security.v:84:5: error: Option and Result types have been split, use `!Foo` to return errors
   82 |             check_required[SecurityScheme](object, 'openIdConnectUrl')?
   83 |             if !check_url_regex(security_scheme.open_id_connect_url) {
   84 |                 return error('Failed SecurityScheme decoding: "OpenIdConnectUrl" do not match url regex expression')
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   85 |             }
   86 |         }
/home/edges/.vmodules/openapi/security.v:88:4: error: Option and Result types have been split, use `!Foo` to return errors
   86 |         }
   87 |         else {
   88 |             return error('Failed SecurityScheme decoding: "type" is not valid $security_scheme.security_type')
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   89 |         }
   90 |     }
/home/edges/.vmodules/openapi/security.v:103:41: error: duplicate of an import symbol `json`
  101 | }
  102 | 
  103 | pub fn (mut flows OAuthFlows) from_json(json Any) ? {
      |                                         ~~~~
  104 |     for key, value in json.as_map() {
  105 |         match key {
/home/edges/.vmodules/openapi/security.v:137:39: error: duplicate of an import symbol `json`
  135 | }
  136 | 
  137 | pub fn (mut flow OAuthFlow) from_json(json Any) ? {
      |                                       ~~~~
  138 |     object := json.as_map()
  139 |     check_required[OAuthFlow](object, 'scopes')?
/home/edges/.vmodules/openapi/security.v:163:3: error: Option and Result types have been split, use `!Foo` to return errors
  161 | fn (mut flow OAuthFlow) validate() ? {
  162 |     if flow.authorization_url != '' && !check_url_regex(flow.authorization_url) {
  163 |         return error('Failed OAuthFlow decoding: "AuthorizationUrl" do not match url regex expression')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  164 |     }
  165 |     if flow.token_url != '' && !check_url_regex(flow.token_url) {
/home/edges/.vmodules/openapi/security.v:166:3: error: Option and Result types have been split, use `!Foo` to return errors
  164 |     }
  165 |     if flow.token_url != '' && !check_url_regex(flow.token_url) {
  166 |         return error('Failed OAuthFlow decoding: "tokenUrl" do not match url regex expression')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  167 |     }
  168 |     if flow.refresh_url != '' && !check_url_regex(flow.refresh_url) {
/home/edges/.vmodules/openapi/security.v:169:3: error: Option and Result types have been split, use `!Foo` to return errors
  167 |     }
  168 |     if flow.refresh_url != '' && !check_url_regex(flow.refresh_url) {
  169 |         return error('Failed OAuthFlow decoding: "refreshUrl" do not match url regex expression')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  170 |     }
  171 | }
/home/edges/.vmodules/openapi/server.v:13:38: error: duplicate of an import symbol `json`
   11 | }
   12 | 
   13 | pub fn (mut server Server) from_json(json Any) ? {
      |                                      ~~~~
   14 |     object := json.as_map()
   15 |     check_required[Server](object, 'url')?
/home/edges/.vmodules/openapi/server.v:42:55: error: duplicate of an import symbol `json`
   40 | }
   41 | 
   42 | pub fn (mut server_variable ServerVariable) from_json(json Any) ? {
      |                                                       ~~~~
   43 |     object := json.as_map()
   44 |     check_required[ServerVariable](object, 'default')?
/home/edges/.vmodules/openapi/server.v:57:4: error: Option and Result types have been split, use `!Foo` to return errors
   55 |     if 'enum' in object {
   56 |         if server_variable.enum_values.len == 0 {
   57 |             return error('Failed ServerVariable decoding: "enum" should not be empty.')
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   58 |         }
   59 |         if server_variable.default_value !in server_variable.enum_values {
/home/edges/.vmodules/openapi/server.v:60:4: error: Option and Result types have been split, use `!Foo` to return errors
   58 |         }
   59 |         if server_variable.default_value !in server_variable.enum_values {
   60 |             return error('Failed ServerVariable decoding: "default" should be in "enum".')
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   61 |         }
   62 |     }
/home/edges/.vmodules/openapi/tag.v:13:32: error: duplicate of an import symbol `json`
   11 | }
   12 | 
   13 | pub fn (mut tag Tag) from_json(json Any) ? {
      |                                ~~~~
   14 |     object := json.as_map()
   15 |     check_required[Tag](object, 'name')?
main.v:7:43: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
    5 | 
    6 | fn main() {
    7 |   mut content := os.read_file("test.json")?
      |                                           ^
    8 |   $dbg; 
    9 | }
/home/edges/.vmodules/openapi/helpers.v:8:24: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
    6 | 
    7 | pub fn decode[T](src string) ?T {
    8 |     res := raw_decode(src)?
      |                           ^
    9 |     mut typ := T{}
   10 |     typ.from_json(res)?
/home/edges/.vmodules/openapi/helpers.v:17:25: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
   15 | 
   16 | pub fn decode_array[T](src string) ?[]T {
   17 |     json := raw_decode(src)?
      |                            ^
   18 |     mut typ := []T{}
   19 |
/home/edges/.vmodules/openapi/helpers.v:17:2: error: duplicate of an import symbol `json`
   15 | 
   16 | pub fn decode_array[T](src string) ?[]T {
   17 |     json := raw_decode(src)?
      |     ~~~~
   18 |     mut typ := []T{}
   19 |
/home/edges/.vmodules/openapi/helpers.v:43:25: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
   41 | 
   42 | pub fn decode_map[T](src string) ?map[string]T {
   43 |     json := raw_decode(src)?
      |                            ^
   44 |     mut typ := map[string]T{}
   45 |
/home/edges/.vmodules/openapi/helpers.v:43:2: error: duplicate of an import symbol `json`
   41 | 
   42 | pub fn decode_map[T](src string) ?map[string]T {
   43 |     json := raw_decode(src)?
      |     ~~~~
   44 |     mut typ := map[string]T{}
   45 |
/home/edges/.vmodules/openapi/helpers.v:73:25: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
   71 | 
   72 | pub fn decode_map_sumtype[T](src string, verif fn (string) bool) ?map[string]ObjectRef[T] {
   73 |     json := raw_decode(src)?
      |                            ^
   74 |     mut typ := map[string]ObjectRef[T]{}
   75 |
/home/edges/.vmodules/openapi/helpers.v:73:2: error: duplicate of an import symbol `json`
   71 | 
   72 | pub fn decode_map_sumtype[T](src string, verif fn (string) bool) ?map[string]ObjectRef[T] {
   73 |     json := raw_decode(src)?
      |     ~~~~
   74 |     mut typ := map[string]ObjectRef[T]{}
   75 |
/home/edges/.vmodules/openapi/helpers.v:87:4: error: Option and Result types have been split, use `!Foo` to return errors
   85 |     for field in required_fields {
   86 |         if field !in object {
   87 |             return error('Failed $T.name decoding: "$field" not specified !')
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   88 |         }
   89 |     }
/home/edges/.vmodules/openapi/reference.v:29:21: error: duplicate of an import symbol `json`
   27 | pub type ObjectRef[T] = Reference | T
   28 | 
   29 | pub fn from_json[T](json Any) ?ObjectRef[T] {
      |                     ~~~~
   30 |     if tmp := decode[Reference](json.json_str()) {
   31 |         return tmp
/home/edges/.vmodules/openapi/reference.v:34:3: error: Option and Result types have been split, use `!Foo` to return errors
   32 |     }
   33 |     return decode[T](json.json_str()) or {
   34 |         return error('Failed ObjectRef[$T.name] decoding: $err')
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   35 |     }
   36 | }

V Doctor:

V full version V 0.4.10 09d83a161306549738ed7fdddec55c518e491bd0.b87aed8
OS linux, Linux version 6.14.4-300.fc42.x86_64 (mockbuild@8915e3b261ab4815937ad79f20ff5d24) (gcc (GCC) 15.0.1 20250418 (Red Hat 15.0.1-0), GNU ld version 2.44-3.fc42) #1 SMP PREEMPT_DYNAMIC Fri Apr 25 15:43:38 UTC 2025
Processor 16 cpus, 64bit, little endian, AMD Ryzen 7 5800U with Radeon Graphics
Memory 1.71GB/15.01GB
V executable /home/edges/v/v
V last modified time 2025-04-26 11:55:52
V home dir OK, value: /home/edges/v
VMODULES OK, value: /home/edges/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/edges/Documents/dev/v/swag
Git version git version 2.49.0
V git status weekly.2025.17 (87 commit(s) behind V master)
.git/config present true
cc version cc (GCC) 15.1.1 20250425 (Red Hat 15.1.1-1)
gcc version gcc (GCC) 15.1.1 20250425 (Red Hat 15.1.1-1)
clang version clang version 20.1.3 (Fedora 20.1.3-1.fc42)
tcc version tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux)
tcc git status thirdparty-linux-amd64 696c1d84
emcc version N/A
glibc version ldd (GNU libc) 2.41

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions