by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 03 2017 20:53
    tejainece opened #101
  • Jun 03 2017 20:52
    tejainece closed #100
  • Jun 03 2017 20:41
    tejainece synchronize #100
  • Jun 03 2017 20:15
    tejainece opened #100
  • Jun 03 2017 19:46

    tejainece on master

    Merge pull request #25 from Jag… Jaguar 0.5.x primary changes Big step towards 0.5.0 and 1 more (compare)

  • Jun 03 2017 19:46
    tejainece closed #99
  • Jun 03 2017 18:18
    tejainece opened #99
  • Mar 09 2017 18:38
    tejainece closed #98
  • Mar 09 2017 18:38
    tejainece commented #98
  • Mar 04 2017 08:39
    tejainece opened #98
  • Mar 03 2017 15:43
    tejainece closed #95
  • Mar 03 2017 15:43
    tejainece commented #95
  • Feb 28 2017 17:00
    lejard-h assigned #97
  • Feb 28 2017 17:00
    lejard-h assigned #96
  • Feb 28 2017 17:00
    lejard-h opened #97
  • Feb 28 2017 17:00
    lejard-h opened #96
  • Feb 28 2017 16:58
    lejard-h closed #90
  • Feb 28 2017 16:58
    lejard-h commented #90
  • Feb 27 2017 21:39

    Kleak on master

    Version bump Merge pull request #24 from Jag… Added glob route matching witho… and 2 more (compare)

  • Feb 27 2017 21:39
    Kleak closed #92
Ravi Teja Gudapati
@tejainece
@rhalff Thanks for the fix. Merged and published it to pub.
Rob Halff
@rhalff
@tejainece ok cool, thanks! :)
For me it was super useful to generate the client code.
Jaumard
@jaumard
@rhalff glad someone else is using it 😀
Rob Halff
@rhalff
@jaumard ah you are the one who've created it. Tight communication here :)
there is a small bug though, it generates old style extension of the api client class.
It doesn't mix in the generated code but extends it.
Guess I should file a bug.
Jaumard
@jaumard
@rhalff what do you mean by old style extension ? Yeah fill a bug on what you have and what you expect :) I’ll take a look !
Rob Halff
@rhalff

@jaumard this one: https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/dart-jaguar/api.mustache#L15

class {{classname}} extends _${{classname}}Client implements ApiClient

It should be class {{classname}} extends ApiClient with _${{classname}}Client

I'm not sure if that was the only thing I've changed though, so would have to try and generate it again.
Jaumard
@jaumard
I didn’t have to change anything to have it working on my side and use it in two different project, it didn’t worked for you ?
Rob Halff
@rhalff
It didn't work, perhaps it's because of different versions, or are your generated projects using the latest jaguar packages also?
Jaumard
@jaumard
no I use only what’s generated, that strange that it didn’t work for you, if you can provide the error message you have and your openapi definition for me to try reproduce it :)
Rob Halff
@rhalff
Not sure if it's very relevant though, because it's mostly about generating and then tweaking the output anyway.
Jaumard
@jaumard
I never touch what’s generated :) that only me to only maintain the openapi definition and re generate as I need
Rob Halff
@rhalff

@jaumard this is the definition: https://gist.github.com/rhalff/b5df25f4af852c7ac21fe042a8b9e9fa

I notice I used my solution as a fix for unimplemented methods, so perhaps what I did was not the correct solution (using it as mixin instead):
Missing concrete implementations of ApiClient.decodeList, ApiClient.decodeOne, getter ApiClient.converters, getter ApiClient.jsonConverter and 1 more.

Jaumard
@jaumard
@rhalff thanks !! I’ll check this ! maybe I miss this change when I update the deps ^^
Jaumard
@jaumard
@rhalff you’re using openapi v.4.0.1 ?
Rob Halff
@rhalff
@jaumard it's version is swagger 2.0 if that's what you mean. I don't control the server, I'm targeting this api: https://backendapi.turing.com/docs
Jaumard
@jaumard
ho @rhalff ! you’re using swagger generator ! I didn’t update this one since a while :D
please use https://github.com/OpenAPITools/openapi-generator :)
that the most up to date ^^
Rob Halff
@rhalff
oh ok, my fault :)
Jaumard
@jaumard
from what I’ve understand the swagger generator is kind of no more update and abandoned ^^
And I don’t want to keep updated two generators that does the same ^^
openapi generator is generating without compilation errors ;)
Rob Halff
@rhalff
ok thanks, will try that one also, just to see what has changed.
I didn't keep up with swagger vs openapi.
Rob Halff
@rhalff
The open api generator indeed generates correctly and is much improved, sorry for the confusion. A real time saver for flutter projects this is.
Jaumard
@jaumard
no problem ! glad it work :)
Ravi Teja Gudapati
@tejainece
Nice!
Rob Halff
@rhalff
Is there a generator for the validator? https://github.com/Jaguar-dart/jaguar_validate
The description hints there is: A simple, source generated Validator framework
Otherwise I'll try to write one myself.
Rob Halff
@rhalff
Something like this:
// order.validator.dart

const nameValidator = Validate.string
  .isNotNull()
  .isNotEmpty(trim: true)
  .startsWithAlpha()
  .hasLengthLessThan(10);

@GenValidator(
  fields: {
    'productName': nameValidator,
    ,
  }
)
class OrderValidator extends Validator<Order>
    with _$OrderValidator {}

// order.validator.jval.dart
abstract class _$OrderValidator implements Validator<Order> {
  final _validators = {
    'productName': nameValidator,
  };

  Validator<ProductAttribute> __productAttributeValidator;
  Validator<ProductAttribute> get _productAttributeValidator =>
      __productAttributeValidator ??= ProductAttributeValidator();
  @override
  List<dynamic> validate(Order model) {
    if (model == null) return null;
    ObjectErrors errors = new ObjectErrors();
    errors.add(validateField(
        'attributes',
        codeIterable(
            model.attributes,
            (val) =>
                _productAttributeValidator.validate(val as ProductAttribute))));
    errors.add(validateField<String>('productName', model.productName));
    errors.add(validateField<int>('quantity', model.quantity));
    errors.add(validateField<double>('unitCost', model.unitCost));
    errors.add(validateField<double>('subtotal', model.subtotal));
    return errors;
  }

  @override
  List<dynamic> validateField<T>(String fieldName, T value) {
    const validator = validators[fieldName];

    if (validator != null) {
      return validator.validate(value);
    }
  }
}

// Usage:
final orderValidator = OrderValidator();

orderValidator.validate(Order order);

orderValidator.validateField('productName', value);
Perhaps it's not worth a generator though, not sure :-)
Ravi Teja Gudapati
@tejainece
Yes
I think it is easier to the validations right away
The package is slightly outdated.
Contributions are welcome!
Rob Halff
@rhalff
@tejainece yeah I've noticed, the pubspec of validate still contains sdk: ">=1.8.0 <2.0.0" which is hopefully not necessary. And the test dependency is outdated.
Ravi Teja Gudapati
@tejainece
Yes
It is probably very easy to update it to Dart 2.x
lewcianci
@lewcianci
Hi everyone :) trying to use this package on my flutter app because it looks great but am having some issues getting started...
The getting started guide says to do this after setting up the beans so the codegen can run: pub run build_runner build
i've found that i have to prefix that command with 'flutter' (so flutter pub run build_runner build) to get it to work...
but no code is generated...

this is the log of the command running
C:\code\MapManFlutter>flutter pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 467ms

[INFO] Initializing inputs
[INFO] Reading cached asset graph...
[INFO] Reading cached asset graph completed, took 119ms

[INFO] Checking for updates since last build...
[INFO] Checking for updates since last build completed, took 996ms

[INFO] Running build...
[INFO] Running build completed, took 17ms

[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 63ms

[INFO] Succeeded after 93ms with 0 outputs (0 actions)