25 Commits
Author SHA1 Message Date
lewisf 5fa4525869 Revert "Add typeName for nested property objects (#294)"
This reverts commit 3161d224d7.
2017-11-25 23:06:42 -08:00
Sirui Li 3161d224d7 Add typeName for nested property objects (#294)
* Add typeName for nested property objects

* Add test for Flow

* Add typeName for nested property objects for TypeScript
2017-11-25 14:52:27 -08:00
Sirui Li 270b7bf4cb flow: Correct typename values for fragments on non-abstract types (#292) 2017-11-07 10:50:50 +01:00
Simon Lydell fdecc2707c Fix __typename for List types in Flow (#276)
* Add test case with bad snapshot for __typename in Flow

* Fix __typename for List types in Flow

By copying the `getObjectTypeName` function from the TypeScript
implementation.
2017-10-21 08:20:49 -07:00
Piotr Czarnecki 4825284211 Allow multiline comments in enums 2017-08-30 10:02:19 +02:00
Piotr Czarnecki 3904365e1a Flow code generation for scalar fields in document root 2017-08-30 10:01:56 +02:00
Martijn Walraven d74b5749ed Move schemas to test/fixtures and some test clean up 2017-08-14 17:05:24 +02:00
Martijn Walraven 3bcaa8c603 Initial version of new compiler and IR 2017-08-14 17:05:24 +02:00
Robin Ricard b5113cb28a Top-line __typename is not a string anymore (#188)
* Top-line __typename is not a string anymore

Replaced with the correct type name

Fixes #183

* Test the cases described in #183
2017-07-25 23:04:46 +02:00
Robin Ricard d8f6a6d157 Detect inner array elements that are nullable and mark them as nullable (#186)
* Detect inner array elements that are nullable and mark them as nullable

Fixes #122

* Test non-null array elements as well
2017-07-25 22:26:57 +02:00
Lewis Chung c866a123f1 support multiline comments in flow/typescript (#149) 2017-06-26 10:45:21 +02:00
Robin Ricard 2e50dbc336 Improve handling of fragments for Flow/Typescript targets (#143)
* Don’t Swift-ify meta field names - they shouldn’t look like regular fields (#97)

* Fix addTypename for Swift target

* Revert "Use disjoint unions on fragments w/ interfaces (#86)"

This reverts commit c5452824e5.

* progress

* fix fragment spread handling

* handle __typename fields by properly generating types with string literals based on type condition

* fix handling of fragment spreads and inline fragments within fragments on concrete type conditions

* Fix handling property declarations of concrete types

* use updates to IR from #128

* rehook up add-typename

* fix up tests by passing in addTypename: true

* remove some unnecessary fields

* add comments to confusing bits

* Fixed several issues post-rebase

During the rebase I mainly favored master but this PR rolled back features from there. This PR mainly fixes that.

* copy over flow target updates to typescript target

* Fix a few indentation issues

* fix rebase error on validations

* ExplicitTypename should only error on the swift target

* fix missed rebase
2017-06-22 09:11:22 -07:00
Martijn Walraven faa5715aee New Swift target (#128)
This bundles changes to support a new Swift target for Apollo iOS.
2017-06-06 17:04:55 +02:00
Lewis Chung c5452824e5 Use disjoint unions on fragments w/ interfaces (#86)
* Handle fragment interfaces better

Instead of concat'ing inline fragment fields, it makes more sense
to create a type for each inline fragment and then union'ing them.

* Implement typescript inline fragment interfaces

* Update typescript snapshots

* Remove explicit typename validation for non-Swift targets

* Do not set description on field for __typename

If we're allowing explicit typename, we cannot make the assumption
that every field is a normal field -- rather that some fields
are introspection fields that do not have a description.

* Retrieve the __typename from the parentType

* remove console.log

* some minor fixes

* Handle fragment interfaces better

Instead of concat'ing inline fragment fields, it makes more sense
to create a type for each inline fragment and then union'ing them.

* Implement typescript inline fragment interfaces

* Update typescript snapshots

* Only generate typename within the flow/typescript codegen instead of adding it to the IR

* Fix fragments in various areas

- Fix fragments that are in selection sets that are not fragments
- Fix fragments in fragment on interface in fragment on interface
- Ensure works with type alias

* Use better unique names to name resulting fragment types

- If inline fragments in fragments, nothing changes
- If inline fragments in a selection set that is not part of a fragment,
use the operation name as the suffix.

* get __typename added to all the right places

* Handle fragment interfaces better

Instead of concat'ing inline fragment fields, it makes more sense
to create a type for each inline fragment and then union'ing them.

* Implement typescript inline fragment interfaces

* Update typescript snapshots

* Remove explicit typename validation for non-Swift targets

* Do not set description on field for __typename

If we're allowing explicit typename, we cannot make the assumption
that every field is a normal field -- rather that some fields
are introspection fields that do not have a description.

* Retrieve the __typename from the parentType

* remove console.log

* some minor fixes

* Only generate typename within the flow/typescript codegen instead of adding it to the IR

* Fix fragments in various areas

- Fix fragments that are in selection sets that are not fragments
- Fix fragments in fragment on interface in fragment on interface
- Ensure works with type alias

* Use better unique names to name resulting fragment types

- If inline fragments in fragments, nothing changes
- If inline fragments in a selection set that is not part of a fragment,
use the operation name as the suffix.

* get __typename added to all the right places

* downgrade inflected
2017-05-09 20:35:11 -07:00
lewisf 589ea809f9 Move expectations/assertions and syntax to Jest
- it(name: string, test: function) => test(name: string, test: function)
- Use jest expectations
- Remove chai
2017-04-23 10:32:44 -07:00
lewisf 5e06fbdef3 fix all tests by moving to snapshots 2017-04-22 22:16:52 -07:00
korbin f3e49afeb2 emit flow typedefs with exact brackets, fragment spreading (#83) 2017-03-22 17:26:45 +01:00
Jacob Kristhammar 8a4546bcc6 Use flow's type for custom scalars (#80) 2017-03-21 23:51:50 +01:00
Jacob Kristhammar d025f49b6b Fix bug with inconsistent fragment capitalization (#79) 2017-03-21 23:51:42 +01:00
Martijn Walraven b39a733b4c Use input object field name instead of property name
Fixes apollographql/apollo-ios#47.
2017-02-01 21:38:49 +01:00
Robin Ricard 8824c6bcb1 Add semicolumns after typedefs
Choosing the most defined style here.
2016-12-18 18:55:25 +01:00
Robin Ricard 0172a88605 Use type declarations instead of interfaces
More used with flow, more predictable
2016-12-18 18:48:12 +01:00
Robin Ricard a88d832c5d Correct nullables with fragment spreads 2016-12-18 18:36:19 +01:00
Robin Ricard afffda1a35 Add the @flow pragma to flow gen 2016-12-14 12:21:27 +01:00
Robin Ricard 644b56ebf1 Basic flow support
Mainly copy-pasta from typescript, only the nullables changes...
2016-12-10 16:30:55 +01:00