mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-02 17:42:16 +01:00
everything runs through now, only ordering missing
This commit is contained in:
@@ -188,6 +188,10 @@ class DictObject(object):
|
||||
"""as dict.items"""
|
||||
return list(self.__dict__.items())
|
||||
|
||||
def _items(self):
|
||||
"""as dict.items, avoiding name clashes"""
|
||||
return list(self.__dict__.items())
|
||||
|
||||
def pop(self, key, default=sys):
|
||||
"""as dict.pop"""
|
||||
if default is sys:
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
DELEGATE_PROPERTY_NAME, struct_type_bounds_s, scope_url_to_variant,
|
||||
re_find_replacements, ADD_PARAM_FN, ADD_PARAM_MEDIA_EXAMPLE, upload_action_fn, METHODS_RESOURCE,
|
||||
method_name_to_variant, unique_type_name, size_to_bytes, method_default_scope,
|
||||
is_repeated_property, setter_fn_name, ADD_SCOPE_FN, rust_doc_sanitize)
|
||||
is_repeated_property, setter_fn_name, ADD_SCOPE_FN, rust_doc_sanitize, items)
|
||||
|
||||
def get_parts(part_prop):
|
||||
if not part_prop:
|
||||
@@ -336,7 +336,7 @@ ${capture(lib.test_hub, hub_type_name, comments=show_all) | hide_filter}
|
||||
// into the respective structure. Some of the parts shown here might not be applicable !
|
||||
// ${random_value_warning}
|
||||
let mut ${rb_name} = ${request_value_type}::default();
|
||||
% for spn, sp in request_value.get('properties', dict()).items():
|
||||
% for spn, sp in items(request_value.get('properties', dict())):
|
||||
% if parts is not None and spn not in parts:
|
||||
<% continue %>
|
||||
% endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
IO_TYPES, activity_split, enclose_in, REQUEST_MARKER_TRAIT, mb_type, indent_all_but_first_by,
|
||||
NESTED_TYPE_SUFFIX, RESPONSE_MARKER_TRAIT, split_camelcase_s, METHODS_RESOURCE, unique_type_name,
|
||||
PART_MARKER_TRAIT, canonical_type_name, TO_PARTS_MARKER, UNUSED_TYPE_MARKER, is_schema_with_optionals,
|
||||
rust_doc_sanitize)
|
||||
rust_doc_sanitize, items)
|
||||
%>\
|
||||
## Build a schema which must be an object
|
||||
###################################################################################################################
|
||||
@@ -12,7 +12,7 @@
|
||||
<% struct = 'pub struct ' + unique_type_name(s.id) %>\
|
||||
% if properties:
|
||||
${struct} {
|
||||
% for pn, p in properties.items():
|
||||
% for pn, p in items(properties):
|
||||
${p.get('description', 'no description provided') | rust_doc_sanitize, rust_doc_comment, indent_all_but_first_by(1)}
|
||||
% if pn != mangle_ident(pn):
|
||||
#[serde(rename="${pn}")]
|
||||
@@ -111,7 +111,7 @@ impl ${TO_PARTS_MARKER} for ${s_type} {
|
||||
/// the parts you want to see in the server response.
|
||||
fn to_parts(&self) -> String {
|
||||
let mut r = String::new();
|
||||
% for pn, p in s.properties.items():
|
||||
% for pn, p in items(s.properties):
|
||||
<%
|
||||
mn = 'self.' + mangle_ident(pn)
|
||||
rt = to_rust_type(schemas, s.id, pn, p, allow_optionals=allow_optionals)
|
||||
|
||||
@@ -172,7 +172,7 @@ def to_cli_schema(c, schema):
|
||||
properties[e.type_value] = e
|
||||
# end handle enumerations
|
||||
|
||||
for pn, p in properties.items():
|
||||
for pn, p in util.items(properties):
|
||||
def set_nested_schema(ns):
|
||||
if ns.fields:
|
||||
fd[pn] = ns
|
||||
|
||||
@@ -114,6 +114,12 @@ data_unit_multipliers = {
|
||||
|
||||
HUB_TYPE_PARAMETERS = ('C', 'A')
|
||||
|
||||
def items(p):
|
||||
if isinstance(p, dict):
|
||||
return p.items()
|
||||
else:
|
||||
return p._items()
|
||||
|
||||
# ==============================================================================
|
||||
## @name Filters
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -746,8 +752,8 @@ def new_context(schemas, resources, methods):
|
||||
# end this is already a perfectly valid type
|
||||
|
||||
properties = s.get('properties', {'': s})
|
||||
print(properties)
|
||||
for pn, p in properties.items():
|
||||
|
||||
for pn, p in items(properties):
|
||||
link_used(p, rs)
|
||||
if is_nested_type_property(p):
|
||||
ns = deepcopy(p)
|
||||
|
||||
Reference in New Issue
Block a user