Commit Graph

133 Commits

Author SHA1 Message Date
Sebastian Thiel
7758f99ff2 fix(dev): typo 2015-03-11 22:59:18 +01:00
Sebastian Thiel
8e78502ffe Merge branch 'builders' 2015-03-11 22:02:48 +01:00
Sebastian Thiel
4f794ef5ff fix(types): fix incorrect nested type names
There was a name-duplication which led to un-inmplemented types.

The good thing is that this was the last issue that kept all 72
APIs from compiling.
2015-03-11 21:59:28 +01:00
Sebastian Thiel
7e243936f2 fix(traits): finally, we pick up all types
HashMap types were missing previously, but now it seems to be picked
up quite nicely.
Would this mean we do the type-setup correctly, everywhere ?
2015-03-11 21:21:11 +01:00
Sebastian Thiel
00de2b187d fix(traits): transitive, minimal traits for types
Previously, I would just assign all useful traits to all types, no
matter on how they were actually used.
Now it builds all dependnecies and considers them when assigning
traits, which is as precise as we need it.

This is important to us as the `Json` type is just encodable, but
not decodable. Fortunately, we just have to encode it, but in theory
this makes it hard to embed any json in a known structure.
2015-03-11 21:00:34 +01:00
Sebastian Thiel
e3ab233a6c fix(schema): no unused types anymore
Due to shared global state which was altered, we got wrong results.
This is fixed now, thanks to a deepcopy. Amazing, how altering global
state is always biting you, even though you are convinced it's safe
to do in just this case !
General rule: Just don't do it, no matter what !
2015-03-11 18:47:37 +01:00
Sebastian Thiel
ac8c41530d feat(schemas): now we pre-generate nested schemas
Into a complete, global list of schemas, with additional meta-data.

However, it's currently not complete, as $refs are missing.
There is some resemblance to to_rust_type(...), which worries me
slightly
2015-03-11 18:01:53 +01:00
Sebastian Thiel
712fed578a feat(json): part 1 to implement 'any' type
It is a Json object, with a schema as defined elsewhere. It's quite
cool to see this (nearly) working already. However, it will require
us to transitively assign the required markers which is based
on information we don't currently have.

Maybe implementing this could also help to simplify name-clash checks
or make them better at least ?
2015-03-11 17:07:07 +01:00
Sebastian Thiel
de40a8bd1e fix(typename): improved camelCasing
Previously, it was possible to get types like Foo_bar, which is not
desireable.
Now it is totally impossible to see such blasphemy ;)
2015-03-11 15:41:49 +01:00
Sebastian Thiel
614539a925 fix(type-clashes): protect from nested-type-clash
It was possible for a nested type to be generated with a name that in
fact CLASHED with an existing schema type. What are the odds !

The clash-check added will just verify against clashes with schema
types, which seems to be doing it for now.
2015-03-11 15:30:11 +01:00
Sebastian Thiel
32145e645e fix(names): nested type names are consistent now
At least so it appears.
The implementation doesn't look totally clean to me, as it seems
similar concerns are in different portions of the code, which was
merely tuned to work together.

It could break appart if someone - me - wants to change it sometime
2015-03-11 14:58:02 +01:00
Sebastian Thiel
538120f7d1 fix(mbuild): scope -> add_scope
This is not only more precisely saying what it does, but also doesn't
clash with scope parameters on resources ;) (happened in dfareporting)
2015-03-11 13:47:55 +01:00
Sebastian Thiel
5b5ad43bfa refactor(schema): deduplicate object creation code
Everything is still working ... maybe it will all work now ?
2015-03-11 12:19:39 +01:00
Sebastian Thiel
dfcd554faa fix(schema): improved nested array type handling
It needs deduplication though, coming up next
2015-03-11 12:14:47 +01:00
Sebastian Thiel
da57505567 fix(types): prevent struct recursion issue
This works by just boxing types which are nested within themselves,
breaking the recursion.
2015-03-11 11:37:45 +01:00
Sebastian Thiel
9b308bb6dd fix(cosmetics): nicer code and identifiers 2015-03-11 11:29:57 +01:00
Sebastian Thiel
54540e695a fix(types): nested types work for arrays
Thanks to removed code which made no sense to me, I put in a bug.
Now the code is back, beta than ever, and documented as well :).
2015-03-11 11:18:22 +01:00
Sebastian Thiel
50fa189a71 fix(schema): now deals with non-objects
These are arrays or HashMaps, which are nested types too. This is used
to have custom types of standard vectors or hashmaps, which resolve
to NewTypes in Rust.
2015-03-11 11:07:03 +01:00
Sebastian Thiel
a268be27d2 fix(types): optionals are working once again
A bug was introduced which caused nested-types not to be optional
in situations were they should.
2015-03-11 10:32:18 +01:00
Sebastian Thiel
5d563c88a8 fix(hash): nested type resolution and hashes
It seems we do it better than the actual Go implementation, which fails
to detect that scopes are actually having a string member.

However, there still is an issue, as it's as hashmap for us, but just
a member for go ... lets see ...
https://developers.google.com/discovery/v1/reference/apis#resource
shows that we implement it correctly :) !!
2015-03-11 10:19:51 +01:00
Sebastian Thiel
559cb8fe45 fix(build): remove compiler warnings.
Also, a build issue was fixed when schemas were no objects.
However, I think I will have to check this one anyway
2015-03-11 09:02:07 +01:00
Sebastian Thiel
bfc3922916 fix(compile): no compiler warnings
This involves disabling the dead-code lint, which is just to ease
debugging, currently there is a lot of dead code as 'hub' is never used.

Soon, this will change, so the lint will be enabled again.
2015-03-11 08:43:24 +01:00
Sebastian Thiel
efe56ad250 fix(util): deepcopy dicts instead
It was possible for writes to happen in nested dicts, causing global
data to change and confuse the system.
Not that I wouldn't be aware of that danger, but apparently I didn't
see the recursiveness of the call tree :).
2015-03-11 08:40:05 +01:00
Sebastian Thiel
cf258bf4e5 fix(build): fixes to help more projects to build
Involving
* complete list of reserved words (keywords in Rust)
* use namespace for otherwise clashing types in cmn::, io::
2015-03-11 08:16:10 +01:00
Sebastian Thiel
d99ba9c5b3 fix(mako): fix name clashes
Scopes could be invalid, previosly, and the hub type could clash
with other types provided as Schema.

Also, we used reserved identifiers
2015-03-10 18:03:35 +01:00
Sebastian Thiel
df9f0299bf fix(mako): deal with missing auth information
Now all APIs can be built successfully, which should help to
prevent things from getting hardcoded in any way.
2015-03-10 17:10:07 +01:00
Sebastian Thiel
c7e169dff3 fix(util): resource-to-category map
It allows to obtain category, which we previously dropped
2015-03-10 16:23:22 +01:00
Sebastian Thiel
7816cc8145 fix(util): do not degenerate during activity_split
First step, next one will actually be keeping that data ...
2015-03-10 16:10:19 +01:00
Sebastian Thiel
1e332ddb91 fix(libdocs): asssure candidate is in mapping
It seems nearly nothing can be taken for granted ;).
It's best to just run against a big set of APIs and fix issues as they
arise though.

More flexibility means more maintenance, after all.
2015-03-10 15:58:39 +01:00
Sebastian Thiel
92d8fa76d0 fix(apis): intermediate improvements ...
... it shows that the override I used previously won't work for `admin`.
Therefore we have to keep the actual value, instead of degenrating it.

Makes sense ... it's interesting how much one tends to hard-code things
to work just for a few cases, unless you opt in to see the whole picture
2015-03-10 15:54:43 +01:00
Sebastian Thiel
ff5cbb3bf4 fix(api-versions): ignore beta/alpha,assure latest
There were a few bugs in the generator program, which caused old
versions to be picked up, and alphas/betas
2015-03-10 15:12:26 +01:00
Sebastian Thiel
9377220c59 chore(data-merge): api-list is now in separte file
This file is completely generated, and allows us to easily bring in
new versions after each json update.

To make that work, we simple merge all data handed to mako-render,
inside of it. That way, we can put 'api/list' data in any yaml.
2015-03-10 15:00:43 +01:00
Sebastian Thiel
2d036b6623 feat(all-apis): build all apis, were possible
Now there is a blacklist feature, allowing to list apis we can't yet
handle for whichever reason.
2015-03-10 14:34:26 +01:00
Sebastian Thiel
2531011fc5 fix(resource): now with flattened activities
That way, we don't have recursive method builders, but instead
flatten the hierarchy. In our case, this is easier and means
less to type. E.g.

`hub.user().message().import(...)` now is
`hub.user().message_import(...)`

In go it would look like this though
`hub.user.messages.import(...)
which is neater.

We will never have that though, as it will initialize a massive amount
of data right on the stack, even though only some of it is ever used
... .
2015-03-10 11:55:11 +01:00
Sebastian Thiel
35bd1c3e9c fix(resources): first recursive resource support
However, this also means we need recursive builders, which is tottally
unsupported for now ... .

This means we have to generalize rbuild generation ... could be easy.
Lets see
2015-03-10 11:04:25 +01:00
Sebastian Thiel
3b7e63f286 fix(scope): make scope gen work with gmail 2015-03-10 10:38:04 +01:00
Sebastian Thiel
7b81646f43 chore(make): update-json and all APIs
It's about time we finish up this part, to make it even easier to test
against more APIs, and keep them up-to-date
2015-03-10 10:34:19 +01:00
Sebastian Thiel
874cfb6f68 chore(cargo): cargo calls for any API
That way, it's so much easier to parallelize doc and test generation,
just to be sure it's truly working.
2015-03-10 10:04:47 +01:00
Sebastian Thiel
6d2b0fc264 fix(scope): scopes are sorted Strings now
That way, we make retrieved tokens independent of the order scopes
were passed in. Additionally, we can pass any scopes, just in case
someone uses one token for multiple APIs.
Let's keep it flexible.
2015-03-10 09:31:29 +01:00
Sebastian Thiel
28878e0618 fix(Scope): Manual scope parameter ...
... however, it should better be a set, and there must be a way to
control certain global names using the configuration :)
2015-03-10 09:05:03 +01:00
Sebastian Thiel
bb76832b2f feat(lib): new Scope enum type
For use in all places where scopes are desired. It will also be made
available for adding scopes by the user.
2015-03-10 08:35:57 +01:00
Sebastian Thiel
9bcb3f8ba9 docs(params): for additional parameters
Based on the parameters suitable for the entire API. One could also
make them available in the builder ... .
2015-03-10 07:54:58 +01:00
Sebastian Thiel
e1b7a63f06 feat(mbuild): scope as property ...
... however, it will become an enumeration, as I don't like people
putting in strings all by themselves. This also means we have to
generate good enums ourselves.
2015-03-10 07:43:49 +01:00
Sebastian Thiel
aabed38581 feat(doit): query string setup
It works for uploads as well as for others.

Next up is to setup the head and authentication. It will be as simple
as calling and handling `GetToken`, even though I think that there
needs to be better support for the scope that is asked for ... .
2015-03-09 17:29:44 +01:00
Sebastian Thiel
da300e035e feat(result): generic result type
... and we actually add additional fields to our fields list.
2015-03-09 16:16:13 +01:00
Sebastian Thiel
7c6f7d5e97 feat(params): additional fields and Result type
Now query params are handled completely, including clash check.
Additionally, there is a new result type which encapsulates everything.

It must be typed to the actual result type though, which can be a
request result
2015-03-09 15:49:53 +01:00
Sebastian Thiel
6c41660943 feat(fields): put all fields onto a list
Also handle the case when the 'part' field is generated from the
request. Additional params still need work
2015-03-09 15:26:04 +01:00
Sebastian Thiel
1423e46210 fix(delegate): it now works in every which way
Custom property annotations have been very useful, to steer very special
cases.

It's also good that now there is enough infrastructure to deal with
any amount of additional type parameters.
2015-03-09 11:55:33 +01:00
Sebastian Thiel
432faa275f feat(dev): spike to see how delegate can be work
To avoid an additional type parameter, we will use dynamic dispatch
for the delegate.

Having function overrides at some point seems like an excercise better
left for version 1.1 ;)
2015-03-09 11:18:44 +01:00
Sebastian Thiel
678b6929ca feat(delegate): first attempt to get it to work
With a big but ! The most simple thing to do it was to just add
additional type parameters to the respective method.

Now the type cannot be inferred, which means type-hints must be added.
This should be easy enough, but ... has to be done somehow.
2015-03-09 10:44:13 +01:00