OpenAPIPathItem.fromJson constructor

OpenAPIPathItem.fromJson(
  1. Map<String, Object?> json
)

Wraps decoded JSON.

Implementation

factory OpenAPIPathItem.fromJson(Map<String, Object?> json) =>
    OpenAPIPathItem._({
      r'$ref': ?optionalString(json, r'$ref', scope: 'openapi path item'),
      'summary': ?optionalString(json, 'summary', scope: 'openapi path item'),
      'description': ?optionalString(
        json,
        'description',
        scope: 'openapi path item',
      ),
      if (json.containsKey('servers'))
        'servers':
            requireList(json['servers'], scope: 'openapi path item.servers')
                .map(
                  (entry) => OpenAPIServer.fromJson(
                    requireMap(entry, scope: 'openapi path item'),
                  ),
                )
                .toList(),
      if (json.containsKey('parameters'))
        'parameters': _decodeParameters(json['parameters']),
      'get': ?_operation(json, 'get'),
      'put': ?_operation(json, 'put'),
      'post': ?_operation(json, 'post'),
      'delete': ?_operation(json, 'delete'),
      'options': ?_operation(json, 'options'),
      'head': ?_operation(json, 'head'),
      'patch': ?_operation(json, 'patch'),
      'trace': ?_operation(json, 'trace'),
      ...extractExtensions(json),
    });