Supporting $ref to relative path

I have a Swagger 2.0 spec api/spec.json and inside there I want to have a reference to a local file api/defs.json for my definitions. So in spec.json I'm doing something like:
    "/message": {
      "post": {
        "parameters": [{
          "name": "message",
          "in": "body",
          "schema": {
            "$ref": "defs.json"
          }

where defs.json looks like
{
    "properties": {
      "text": {
        "type": "string"
      }
    },
    "required": ["text"]
}

But I just get #/paths/~1message/post/parameters/0/schema/$ref: Not a valid JSON Reference on init
I've tried several variations like:
"$ref" : "./defs.json"

This starts but fails with #: Reference could not be resolved: ./defs.json when a request is sent.
I have read that $ref supports internal and remote (with an absolute URL), but not been able to find any documentation on relative paths.
Here is a mention that this might be possible already: https://github.com/swagger-api/swagger-spec/issues/275#issuecomment-95232922
Here is a mention that it has just been implemented in swagger-js: https://github.com/swagger-api/swagger-js/issues/417
Are relative paths supported at all?

JSON Reference resolution is handled by json-refs and there is a known issue for supporting this: whitlockjc/json-refs/issues/11.  I will keep this open in here until this issue is resolved in json-refs.

@whitlockjc Is there any news on this? Absolute URLs are far from ideal.

This should be fixed but there is currently a bug in json-refs/issues/24 that you need to be careful of.  No circular remote/relative references?  Things will work like you want.

@whitlockjc,
It's not working for me. Am I doing something wrong?
http://pastie.org/private/0ozh5wm8li9qrrifl9cbua (swagger.yaml)
http://pastie.org/private/6coezsiq2d9bmawl4yygg (definitions/models/videos/video.yaml)

How are you loading swagger.yaml?

With Swagger UI.
Also, it seems to request the main file 8 times when I reference the video file, but it doesn't request the video file itself.

swagger-ui does not support relative references.

I'm going to reopen the issue until I have unit tests showing it works but swagger-ui is not related to swagger-tools.

Thanks @whitlockjc, I guess it's this one: https://github.com/swagger-api/swagger-ui/issues/1456.

It would be great to be able to run this example:
https://github.com/swagger-api/swagger-spec/tree/master/examples/v2.0/yaml/petstore-separate

The problem we have right now with supporting this is that swagger-tools does not know where the original document was loaded from so doing relative reference resolution isn't possible without providing that context.  swagger-tools uses path-loader and json-refs which both support relative references but they do it based on process.cwd on Node.js and window.location in the browser.  Whenever the location of the loaded document is not known and does not conform to the aforementioned defaults, the related json-refs/path-loader APIs have an options.location option to fill in the gap.
That being said, to support this I would need to update all APIs in swagger-tools to support passing this option to json-refs/path-loader.  It's not impossible but it would change the APIs a bit.  I need to think about this a little more.

I'm having a little tough time following, is this only an issue only with swagger-ui? I'm unable to get it to work using the swagger-node module loading swagger.yaml (completely in node, no browser in the chain at all)
Relevant snippet
swagger.yaml (snipped)
        default:
          description: Error
          schema:
            $ref: "error.yaml#/ErrorResponse"

error.yaml
ErrorResponse:
  required:
    - errors
  properties:
    errors:
      type: array
      items:
        $ref: "#Error"

Then when running swagger-node's validate I get this:
swagger validate api/swagger/swagger.yaml

Project Errors
--------------
#/paths/~1events/get/responses/default/schema/$ref: Not a valid JSON Reference
Results: 1 errors, 0 warnings

Your #Error reference is wrong.  It should be #/definitions/Error.

Good catch although it appears to be tangential. I changed errors.yaml as a test to be:
ErrorResponse:
  required:
    - errors
  properties:
    errors:
      type: string

What's the error now?  I doubt swagger-node supports relative references just yet since it uses swagger-tools which is known not to support relative references except under certain conditions.

Sorry I should have been more clear. Its the same error as before. Under what conditions does swagger-tools support relative references? I could maybe force them or look thru swagger-node to figure out how to get them to work.

The paths must be relative to process.cwd which is not ideal of course.  So for swagger-node, your relative references would start with ./api/swagger.  So if you had a users.yaml in api/swagger, you'd have something like this:
# ...
  $ref: './api/swagger/users.yaml#/definitions/User'
# ..

Not sure if it's relevant, but what we're doing is using swagger-parser (3.0.0-alpha.5) to dereference our swagger.yaml file (with relative paths), and then we save it as swagger.json and serve that.

swagger-tools dereferences references too but relative references weren't a thing until recently.  When we started work on breaking up swagger-tools, we started swagger-core-api and it does work with relative references.  In face, swagger-core-api does better validation than swagger-tools at this point.  The reason I bring this up is swagger-tools will be deprecated in the future and will be replaced by swagger-core-api and per-server middlewares/plugins that build on top of swagger-core-api.

@whitlockjc I use swagger-editor currently, and it seems that I must wait for it to be updated to use swagger-core-api in order to be usable with relative URLs. Am I getting that right?

Yes.  We are in the process of migrating swagger-editor to swagger-core-api.  Also, supporting relative references for the swagger-editor will likely involve some other work since it's intended right now to be a single-file UI but this could change that.

I'm currently in the process of designing a fairly large set of APIs with various widgets/types reused.
I'd like the Swagger Spec itself to be decomposed into one spec file per path referenced through $ref in YAML. Then the referenced spec file itself reference JSON schema definitions all through HTTP-based relative $ref's -- since the hostname would be tier/deployment-specific:
So (in pseudo-code):
myApiDoc.yaml:
    /my/resource/:
        $ref: "swagger-sppecs/myResource.json"

------

Schema definition in swagger-sppecs/myResource.json:
{
    "properties": {
        "propertyA": {
            "$ref":"../schema/propertyA.json"
        }
    }
}

------

Schema definition in schema/propertyA.json:
{
    "properties": {
        "propertyB": {
            "$ref":"../schema/propertyB.json"
        }
    }
}

My questions are:

With Swagger-Tools, is it possible to decompose/refactor YAML into specs (it looks like it is possible with the new changes)

With Swagger-Tools, is it possible to refactor the referenced JSON schemas themselves to utilize relative ref's in composite widgets and types? Ideally, I would like the schema library to be hosted externally, since the schema definitions could be utilized across technologies and applications.

Any thoughts on the current/upcoming capabilities or recommended patterns around this?

The underlying library swagger-tools uses for JSON Reference resolution (json-refs) supports relative references but to use it requires swagger-tools to know where the loaded Swagger document came from, which it doesn't, and it needs a way to pass this information to json-refs.  To support this we need to alter all APIs to take an options object so that we can pass the location where the Swagger document was loaded from to json-refs.  There is one situation where this can work now but it is not something work documenting: If your relative references are relative to process.cwd() in Node.js or window.location in the browser.

Thank you for the response. I was able to get the Node side to work by making sure the relative refs were off-of process.cwd() like you suggested. However, neither Swagger UI nor Swagger Editor is able to expand the ref'ed schemas. Swagger UI just doesn't work, while Swagger Editor only shows the referenced relative URL for the model.
Is there any way to get Swagger Editor (or UI) to expand the schemas into a more human-friendly view (like it would if the definitions were local and not ref'ed)?
Regarding your comment on window.location, does that imply that the docs would have to served essentially off of process.cwd() for both node and Swagger Editor/UI to work?

swagger-ui is its own thing and they do their own stuff.  swagger-editor uses swagger-tools but remember that references then become relative to window.location and I'm sure that the swagger-editor doesn't serve up any documents other than the one.  swagger-tools supporting relative references is just part of this as the whole tooling ecosystem needs to support it properly.
I'll work on getting swagger-tools to have an API for specifying the document root so relative references work universally.  Then it's up to swagger-editor and others to use the new support.

Thanks again for the response. So is your recommendation for now (until all tools in the ecosystem support the doc root) to just go with a single specification document with all references local to the doc?
Having one large YAML with thousands of lines of specification sounds rather monolithic to me -- so as a newcomer to swagger/tools, I would appreciate your insight on what the prevalent industry patterns are for composing a large set of APIs (essentially around reuse and physical refactoring of the specification document).

What server environment are you using?

node + express

So just Express and swagger-tools or something else?  How does swagger-editor and swagger-ui get into the mix?

I dropped Swagger UI for its inability to reference externally ref'ed schemas.
I have a locally built Swagger Editor that I am hosting on a static server (different than where API would be hosted) -- just to use the UI portion of the editor. The editor portion is not used.
Swagger Editor worked great as long as the ref'd URIs were absolute. But I need them to be relative to support multiple deployment environments, and that's kind of where I'm hitting a roadblock.
The Node+Express side (even mocks) works just fine (even with relative refs).
Only alternative that seems to work with Swagger Editor/UI is to make the YAML spec a monolithic doc with no external or relative refs for schemas.

@dkhanal Did you see my comment above?
Here is our Gulp file: https://gist.github.com/glen-84/f1bdda0bbe9c32da0d3f

Yeah, the Node.js side of things should work because you got the resolution of references working due to changing your references to be relative to process.cwd().  Everything on the Node.js side should work.  If you use the swagger-ui middleware in swagger-tools, it will serve the fully resolved document and a working swagger-ui for it.  @glen-84 has a working recipe as well to work around while we work on doing this in swagger-tools.

@glen-84  Thank you. I will play with this workaround.
@whitlockjc Thanks. Did you mean that swagger-ui middleware would serve a fully resolved document (even when there's relative refs) currently, or it will in the future?

It does already, or it should.

@whitlockjc - No it doesn't appear to be working. It looks like the $ref's are expected to be relative to process.cwd() on the server (and the Node side works), but Swagger UI (served by the middleware) also needs the referenced schemas right off the root accessible from the browser. Not really a clean workaround, IMO. I wanted to express.static(..) the schema folder so that the browser could access it, but not sure how to get express.static(..) to work with swagger-express-mw. Looks like routes are overwritten by the middleware.

@glen-84 I used the swagger-parser tool and it finds the referenced files and everything but complains about a schema issue:
SyntaxError: Data does not match any schemas from "oneOf"
Data path: "/paths/~1user~1login/get/responses/200"
Schema path: "/properties/paths/patternProperties/^~1/properties/get/properties/responses/patternProperties/^([0-9]{3})$|^(default)$/oneOf"
]

Here's the YAML:

paths:
  /user/login:
    get:
      x-swagger-router-controller: "userApi_v1"
      consumes:
        - "application/json"
      produces:
        - "application/json"
        - "text/html"
        - "text/plain"
      description: "Authenticates the specified credentials."
      operationId: "login"
      parameters:
        - name: "username"
          in: "query"
          description: "Username to login as."
          required: true
          type: "string"
        - name: "password"
          in: "query"
          description: "Password to login with."
          required: true
          type: "string"
          format: "password"
        - name: "persistent"
          in: "query"
          description: "Indicates if the client chooses to have a persistent cookie."
          required: false
          type: "boolean"
      responses:
        200:
          description: "Success"
          schema:
            $ref: "schema/json/user/v1/responses/loginResponse.json"
        default:
          description: "Error"
          schema:
            $ref: "schema/json/common/v1/standardError.json"

Here's the referenced loginResponse.json:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "https://myCompany.com/schema/json/user/v1/responses/loginResponse",
  "type": "string",
  "additionalProperties": false,
  "title": "Login Response",
  "name": "/"
}

If you are willing to use swagger-parser, might as well use swagger-core-api since that's the successor to swagger-tools' API.  It supports relative references.

@glen-84 It looks like I now know why I'm getting the validation error. The $schema ref's apparently can't be full-blown JSON Schema Draft 4 objects. If I remove  $schema, id, additionalProperties, and name from the schema definition, then the tool works. The validation is probably done against the Swager 2.0 definition of 'schema', which doesn't support all of the JSON Draft 4 attributes.
@whitlockjc Thanks. Any ideas when swagger-core-api will be officially released? Is it near production?

Within the next day or two.

Ok, sounds good. Can I use it with swagger-express-mw? Please let me know (or point me to doc) how it integrates with or replaces SwaggerExpress.create(...)

No reason why you couldn't.  Here is an example:
function configureServer (swaggerDoc) {
  // Do your server initialization here
}

require('swagger-core-api').create({
  definition: swaggerDocPath
}).then(function (swaggerApi) {
  // Configure server
  configureServer(swaggerApi.resolved);
}, function (err) {
  console.error(err.stack);
  process.exit(1);
});

Just tried to npm install (npm install swagger-core-api --save). It  picked up a package.json and an essentially empty index.js. Nothing else.

npm install https://github.com/apigee-127/swagger-core-api.git --save.  Until I do the next release, the current NPM package is broken as it was created as a temporary placeholder.  I'll do an official release, probably with project rename to make it more intuitive.

Thanks... Installing now. Does it completely replace swagger-express-mw and swagger-tools? Is the CLI that generates the boilerplate going to use this for Node+Express? If so, should I completely do away with my SwaggerExpress.create() and use this instead?

No, this is just an API for doing Swagger integrations.  It provides Swagger document loading (local/remote), reference resolution (local, remote, relative, etc.), document normalization (security requirements, path-level parameters, etc.) and APIs for interacting with the document.  For you, it would be used to load your document to work around swagger-tools not exposing what's necessary to handle relative references.
Pretty soon, after we release the project, we'll start rewriting the middlewares and exposing them individually with more support than just Connect and Connect-based/compatible servers.  Implementations should be much simpler this way.  I'll be writing a blog entry on where we're at and where we're going.

@whitlockjc Good stuff -- thanks!
I tried the following. The UI is served with the YAML expanded/resolved to 1 level of depth, but ref's that are deeper (i.e. those present inside the referenced JSON schemas) are not resolved.
Is there a way to get swagger-core-api to fully expand the document to the leaf level?
 SwaggerApi.create({definition: "./api/swagger/swagger.yaml"})
        .then(function (swaggerApi) {
            // Add swagger-ui (This must be before swaggerExpress.register)
            app.use(new SwaggerUi(swaggerApi.resolved));
        }, function (err) {
            console.error(err.stack);
            process.exit(1);
    });

I assume you're talking about relative references?  With swagger-core-api, relative references work as the should so make sure they are relative to the documents loading them, not process.cwd() like you tried for swagger-tools'.

@whitlockjc Thanks, Jeremy -- I think I figured it out. Looks like the nested $ref's have to be relative to the file where they are referenced.

That is correct.

@whitlockjc Jeremy -- You guys are working on very useful stuff. I'm up and running with swagger-core-api to serve fully resolved docs. Many thanks!

Glad to help.

I'm probably doing something wrong, but if I use SwaggerApi.create and then dump swaggerApi.resolved to a  JSON string, I still see stuff like
{ "info": { "$ref": ".\/info\/index.yaml" } }

rather than the fully resolved value.

I will look into it.

Any update on this, or anything else we can do to help debug?

Can you run something like this:
SwaggerApi.create({...}).then(function (api) {
  console.log(api.references);
});

I want to see if the reference is unresolved.

If I chdir into the directory containing my main index.yaml, I get:
{"#/info":{"err":{},"missing":true,"ref":"./info/index.yaml"},"#/paths":{"err":{},"missing":true,"ref":"./paths/index.yaml"}}

If I pass in swagger/index.yaml as my source (which other conversation here suggested should work), I get:
{"#/info":{"err":{"errno":-2,"code":"ENOENT","path":"info/index.yaml"},"missing":true,"ref":"./info/index.yaml"},"#/paths":{"err":{"errno":-2,"code":"ENOENT","path":"paths/index.yaml"},"missing":true,"ref":"./paths/index.yaml"}}

Both paths exist.

Can you show me your SwaggerApi.create call?  If you use something like this, it should work:
SwaggerApi.create({
  definition: path.join(__dirname, 'swagger', 'index.yaml')
});

I switched things over to Sway yesterday, after the rename, but it's a grunt task that looks like this:
    grunt.registerMultiTask('verifySwagger', 'Build our swagger docs into a single file', function() {
        var o = this.options();
        var Sway = require('sway');
        var done = this.async();
        //process.chdir(o.dir);
        Sway.create({definition: path.join(__dirname, o.dir, o.input)})
            .then(function (swaggerApi) {
                //grunt.fail.warn(process.cwd());
                grunt.fail.warn(JSON.stringify(swaggerApi.references));
                done();
            }, function (err) {
                done(err);
            });

With the process.chdir I get:
{"#/info":{"err":{},"missing":true,"ref":"./info/index.yaml"},"#/paths":{"err":{},"missing":true,"ref":"./paths/index.yaml"}}

Without, I get:
{"#/info":{"err":{"errno":-2,"code":"ENOENT","path":"info/index.yaml"},"missing":true,"ref":"./info/index.yaml"},"#/paths":{"err":{"errno":-2,"code":"ENOENT","path":"paths/index.yaml"},"missing":true,"ref":"./paths/index.yaml"}}

My day is booked with meetings but hopefully tomorrow I can spend some time to dig into Sway code to do some more detailed debugging.

Can you show me your directory structure?  We have tests for this stuff in json-refs, the library that drives reference resolution and Swagger file loading and Mohsen wrote this: http://azimi.me/2015/07/16/split-swagger-into-smaller-files.html  Can you either show me your directory structure and/or create a sample project on GitHub that reproduces the issue?

I must have commented on the wrong issue when I linked to this the other day...  I set my example up here: https://github.com/ex-nerd/swagger-example

If I understand, is this just an example or is there an error to fix?  When I run your code, it works as expected from what I can tell.

I'm not seeing the $ref stuff being parsed properly unless I use json-refs directly.  if you run grunt test it prints out something similar to the error messages I mentioned earlier in this issue.

So, it looks like there were two bugs in sway and they've been fixed: https://github.com/apigee-127/sway/blob/master/RELEASE_NOTES.md#v021-2015-08-26  If you install the latest sway release, this should be fixed.  I did test your example and here is the code I used:
Sway.create({definition: './swagger/index.yaml'})
  .then(function (api) {
    // Your code here
  });

Sorry about that.  json-refs heavily tests relative references and JSON/YAML references so I didn't have a lot of tests in sway for this.

Confirmed that it works, though I'm no longer getting any errors in the Sway.create() promise, even with a broken path for my info section.  The then clause is called and the resolved data looks something like:
{"swagger":"2.0","info":{"$ref":"./info/this_path_doesnt_exist.yaml"}, ...

It's expected.  sway does not validate on create so unresolvable references are left as-is.  If you call the validate method, you'll see it returns false and getLastErrors will return the unresolvable references.  Remember, you're using this as a workaround and the middleware I'm working on to replace the swagger-tools' equivalents will be done soon.  They will be drop in replacements so don't worry.

Sorry about the formatting...I'm mobile.

Gotcha.  I forgot to mention that I assumed it was expected.  I tried to hook into the validation stuff from swagger-tools directly but ran out of time during the work day (and my javascript-fu is fairly weak these days).  Hoping I can eventually get a nice Gruntfile designed to develop/build/test any swagger API, but it sounds like you may beat me to it and just make something like that part of the standard feature set.

Well, the plan has been to take what we learned from swagger-tools and break up the project a little bit.  sway is the API part of swagger-tools, rewritten.  It is complete for the first pass.  We now need to create the replacement middleware and that is when you'll see us doing the pre-startup validation that will do this stuff for you.  You can work around it as described above but you're already using sway to work around swagger-tools' lack of support for relative references so you might be better off waiting a few days so I can get sway-connect released.

Any update on this?  I see that it's been about a month since you suggested you might have sway-connect ready.  Anything I can do to help?

Sorry for the delay.  Since swagger-node uses swagger-tools, I have to get this done.  Give me a few days and I'll publish a release that fixes this in a way that swagger-node can consume.

I've pushed the first pass at this.  I've updated all relevant documentation but here is the short version: All APIs (core and middleware initialization) have been updated to have an optional options argument immediately before the callback argument.  This options object will allow you to set options.jsonRefs.location to the base directory/url where your Swagger document was loaded.
Could any of you verify this works for you?  I've got middleware initialization tests, tests for all APIs and things seem to work but I'd like to hear from someone else prior to doing a release.

Seems there are a few more quirks to work out.  I'm in the process of testing this from the CLI and it's not working right.

I've decided to blow away my efforts on this.  I've worked on this all day and the deeper it gets, the more things break.  Due to the internal meta-model required to support Swagger 1.2 and 2.0, to touch anything related to references is to break it.  This is not an excuse but doing this is much, much larger than originally anticipated.  Sorry for the disappointment but this likely isn't possible without a rewrite.

For me, the schema were resolved if I ran the code from a specific directory - the one that contains my app.js file. Whenever I tried to run my code from another directory using gulp to run my dist or tests it failed because it couldn't resolve the relative schema. A workaround that worked for me is to set the cwd to __dirname at the beginning of my app.js (using process.chdir(__dirname)) file, so when I initialize my swagger docs everything works.

just a :+1: for nested ref support. not possible to have the path from the referencing file if the referenced file is in a submodule that we reuse.

I just updated json-refs to 2.0.x and that will help but I think the real solution will be to rewrite swagger-tools' internals which is not happening right now.  I might see if I can do a sway-based rewrite over the weekend.

I've got a better solution for this as a workaround until either this gets solved in swagger-tools or swagger-tools is finally deprecated by sway and sway-connect:
var JsonRefs = require('json-refs');
var SwaggerTools = require('swagger-tools');
var YAML = require('js-yaml');

JsonRefs.resolveRefsAt('./api/swagger/swagger.yaml', {
  // Resolve all remote references
  filter: ['relative', 'remote'],
  loaderOptions: {
    processContent: function (res, cb) {
      cb(undefined, YAML.safeLoad(res.text));
    }
  }
})
  .then(function (results) {
    SwaggerTools.initializeMiddleware(results.resolved, function (middleware) {
      // Wire up the Swagger middleware
    });
  })
  .catch(function (err) {
    console.error(err.stack);
    process.exit(1);
  });

I'll see if I can work this into swagger-tools without having to rewrite it.  I know the CLI and Middleware are easy fixes but the APIs, as they are now, would require a rewrite to allow you to support references.

What would you all think if I were to blow away the API portion of swagger-tools, since sway provides a real API, and just get the swagger-tools CLI/Middleware to use the approach mentioned above, or even sway?
I'm tired of these issues that require rewrites just sitting here but the rewrite itself doesn't make much sense knowing that swagger-tools the API is no longer useful as sway is much better.  Want to use sway with Swagger 1.2?  Convert the document via the swagger-converter API and then use the sway API.
Thoughts?

Has anything changed recently with Sway in the way it resolves relative references from within JSON schemas:
SwaggerExpress.create(config, function(err, swaggerExpress) {
  if (err) { throw err; }

  Sway.create({definition: "./api/swagger/swagger.yaml"})
      .then(function (swaggerApi) {
        app.use(new SwaggerUi(swaggerApi.resolved));
      }, function (err) {
        console.error(err.stack);
        process.exit(1);
      });

  swaggerExpress.register(app);

  var port = process.env.PORT || 10010;
  var server = app.listen(port);

  console.log('Server listening at: ' + server.address().address + ':' + server.address().port);
});

I get the following error when I start the project:
Error initializing middleware Error: Swagger document(s) failed validation so the server cannot start
If I remove the relative reference from within JSON, it works. Otherwise it fails. The relative reference is correct and the referenced file is present.
This used to work OK until a couple months ago.

Upgrade, I released a fix Friday.

Thanks. I just upgraded Sway. Still get the same error with "sway": "^0.6.0". Anything else that must be upgraded?

I meant to upgrade swagger-tools.  Sway hasnt seen a release and shouldn't be causing issues.

Upgraded swagger-tools. At "swagger-tools": "^0.9.14" still see the issue.

Try using Sway at master then.  I'm not sure what is up because Sway hasn't had any releases to cause any problems and swagger-tools is not doing anything for relative references still.  The approach I documented above is probably better but I'm not sure why something just started failing.  Run with DEBUG=swagger-tools* to get more information on what the failure is.

DEBG=swagger-tools* did not provide anything of much value (first 3 lines below) . The stack looks like this:
swagger-tools:middleware Initializing middleware +0ms
swagger-tools:middleware   Identified Swagger version: 2.0 +0ms
swagger-tools:middleware   Validation: failed +234ms
Error initializing middleware
Error: Swagger document(s) failed validation so the server cannot start
  at ...\node_modules\swagger-tools\index.js:72:13
    at cbWrapper (...\node_modules\swagger-tools\lib\specs.js:1035:5)
    at validateSwagger2_0 (...\node_modules\swagger-tools\lib\specs.js:1030:3)
    at validateSemantically (...\node_modules\swagger-tools\lib\specs.js:1040:5)
    at ...\node_modules\swagger-tools\lib\specs.js:1233:7
    at ...\node_modules\swagger-tools\lib\specs.js:1073:29
    at ...\node_modules\swagger-tools\lib\specs.js:719:12
    at ...\node_modules\swagger-tools\lib\specs.js:695:9

Also, why is SwaggeExpress.create()  does not seem to follow the callback pattern for errors. Here's a simplified example:
SwaggerExpress.create(config, function(err, swaggerExpress) {
    console.log('AFTER SwaggerExpress.create()');
    if (err){
        console.log('There was an ERROR.');
    }
    else
    {
        console.log('There was NO ERROR.');
    }
});

And here's the output (it never gets to the callback function). It seems to be throwing, instead.
BEFORE SwaggerExpress.create()
Error initializing middleware
Error: Swagger document(s) failed validation so the server cannot start
at ...\node_modules\swagger-tools\index.js:72:13
at cbWrapper (...\node_modules\swagger-tools\lib\specs.js:1035:5)
at validateSwagger2_0 (...\node_modules\swagger-tools\lib\specs.js:1030:3)
at validateSemantically (...\node_modules\swagger-tools\lib\specs.js:1040:5)
at ...\node_modules\swagger-tools\lib\specs.js:1233:7
at ...\node_modules\swagger-tools\lib\specs.js:1073:29
at ...\node_modules\swagger-tools\lib\specs.js:719:12
at ...\node_modules\swagger-tools\lib\specs.js:695:9

Here's another finding that may be helpful.
It looks like the relative references ($ref from one schema file to another) are expected to be relative to the application root.
Previously, I believe the relative references ($ref from one schema file to another) were relative to the schema file containing the $ref declaration.
If I change my $refs to now make them relative to the application root, it seems to work.
Was this a breaking change that was introduced recently?

Some more information:
I have a fairly succinct .yaml file where each path contains a $ref to Swagger Specification (in JSON) for the path. Each such specification, then references various other schema (in JSON) files for parameters and responses. Then each schema definition contains one or more $ref's pointing to reusable/common constructs.
This is the working configuration:
$ref's in the swagger.yaml definition are relative to application root.
$ref's in the Swagger Specification JSON (e.g. for parameters and responses) are relative to the specification file containing the $ref.
$ref's in the JSON schema files that point to other JSON schema for reusable constructs are relative to application root. It looks like this is what changed recently. These $ref's, I believe used to be relative to the current schema file (i.e. file containing this $ref).
For example, in the following snippet of a JSON schema, the meta property's $ref must be relative to the application root, rather than relative to the file containing the $ref:
...
...
    },
    "meta": {
      "$ref": "specs/schema/v1/meta.json"
    }
  },
  "required": [
    "data"
  ]
}

swagger-tools and sway are really old so the chances they have bugs does not surprise me.  The more interesting dependency version would be json-refs.  Also, you'd be much better off just not using sway and instead using json-refs with the code snippet I pasted above a few days ago.
Upgrading swagger-tools will give you better output for the failure you're seeing.  You can also run swagger-tools validate YOUR_FILE and it will let you know the failures as well.

`Project Errors
#/paths: Additional properties not allowed: $ref
Results: 1 errors, 0 warnings`
Are $ref's to other files going to be supported soon?
`swagger: "2.0"
info:
version: "0.0.1"
title: Test
during dev, should point to your local machine
host: localhost:10010
basePath prefixes all resource paths
basePath: /

schemes:
tip: remove http to make productio  n-grade

http
https

format of bodies a client can send (Content-Type)
consumes:

application/json
multipart/form-data
application/x-www-form-urlencoded

format of the responses to the client (Accepts)
produces:

application/json
paths:
$ref: ./controllers/program.yaml`

Inside controllers/program.yaml exists the code you would expect to see under the paths: definition.
The error comes from both swagger-tools cli and swagger-node cli validation.

Will you please read some of the comments before yours?  Not only is the answer to your question there but so is the workaround.
On another note, Swagger forbids $ref where you have it so some might say I should be throwing an error there anyways: https://github.com/apigee-127/sway/issues/62

Is there a way to set Json-Ref's options.relativeBase from swagger-tools.initializeMiddleware(doc, cb())?  I have split by yaml files, but I have to include the full paths for every reference. I would like to be able to set a relative base for the docs instead.

This is the problem with the current swagger-tools API.  To allow for you to pass options downstream, every API has to change and that is a breaking change.  So I'd have to release 1.0.0 just to support it.  That's why I've instead suggested the workarounds above until I can get sway-connect out the door.  Thanks for your patience.

Thanks for the quick update, good to know!

Hello! Is there any update on this? I'd love to be able to split up my swagger.yaml file into multiple directories (e.g. paths, definitions, etc.)

This problem still exists in current version.
I saw json-ref has an additional option 'relativeBase' but spec.js doesn't pass in this option.
As for the amount of invocations in spec.js or other files demanded to modify, I suggest to add a new method in json-ref specified for initial default options globally, including 'relativeBase'. Adding a wrapper above json-ref should also do. This way might ease the code work.

Of course this problem still exists, the issue is still open.  The suggested workaround is all you will get for now because rewriting swagger-tools to support this isn't going to happen.  I mentioned this above.  Just use json-refs to resolve your document and then use the resolved document when providing the Swagger document to the swagger-tools functions.

Here is another workaround for those who want to use json-refs with the swagger-node express skeletons:
var JsonRefs = require('json-refs');
var YAML = require('js-yaml');
var SwaggerExpress = require('swagger-express-mw');
var app = require('express')();
// export setup Promis for testing
module.exports = new Promise(function (resolve, reject) {

  JsonRefs.resolveRefsAt('./api/swagger/swagger.yaml', {
    // Resolve all remote references
    filter: ['relative', 'remote'],
    loaderOptions: {
      processContent: (res, cb) => cb(undefined, YAML.safeLoad(res.text))
    }
  })
    .then(results => {
      var config = {
        appRoot: __dirname, // required config
        swagger: results.resolved
      };

      SwaggerExpress.create(config, function (err, swaggerExpress) {
        if (err) { throw err; }

        // install middleware
        swaggerExpress.register(app);

        var port = process.env.PORT || 10010;
        app.listen(port, function() {
          if (swaggerExpress.runner.swagger.paths['/hello']) {
            console.log('try this:\ncurl http://<IP_ADDRESS>:' + port + '/hello?name=Scott');
          }
          resolve(app);
        });
      });
    })
    .catch(function (err) {
      console.error(err.stack);
      process.exit(1);
    });
  ;
});


Update 04-compose.js

Run the above queued actions.

Thanks for your help and interest in Zulip. Closing, since this unfortunately cannot be merged as is, but please make an account on our developers' server at https://chat.zulip.org, and we can find a good project to match your interests.


🥯 Favorite contacts bug fix

Status:

Description :star2:

when there are no favorited contacts, displays "no favorited contacts" instead of spinning icon

Fixes #343

TODOs :star:

looks good!


Add Refined GitHub to the extensions using it

https://github.com/sindresorhus/refined-github/blob/1f7b088/package.json#L36

@bfred-it :shipit:


Textfield gets reset if scrolled out of view

Steps to Reproduce

Use a device with a display similar to an Galaxy S5 SM G900F
Open the "Gallery > Text Fields"
Enter some text in the first field
Tap into the next field and scroll the first field out of view
Scroll it back into view
--> The first field is reset

As a solution I think adding a TextEditingController to the fields might suffice.
Logs
No notable logs
Flutter Doctor
[✓] Flutter (on Linux, locale en_US.UTF-8, channel master)
• Flutter at /home/ben/Desktop/Dev/flutter/flutter
• Framework revision 58f47bd906 (8 hours ago), 2017-08-02 17:34:23 -0700
• Engine revision 1de56a33d2
• Tools Dart version 1.25.0-dev.7.0
[✓] Android toolchain - develop for Android devices (Android SDK 25.0.3)
• Android SDK at /home/ben/Android/Sdk
• Platform android-25, build-tools 25.0.3
• Java binary at: /usr/local/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[✓] Android Studio (version 2.3)
• Android Studio at /usr/local/android-studio
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[✓] Connected devices
• SM G900F • 118f97ca • android-arm • Android 6.0.1 (API 23)
Steps:

@Hixie did some work around keeping alive offscreen widgets in scroll views.  Its possible the gallery example is just missing the proper calls.

Yeah, my TextEditorController proposition was mostly based on this discussion: https://stackoverflow.com/questions/45240734/flutter-form-data-disappears-when-i-scroll

Hi everyone, we are experiencing same behavior with TextFormFiled as well as ExpansionTile widgets - when scrolled off screen in a ListView, both lose state.
The suggested workaround - to set a controller on a TextField does not work on ExpansionTile (setting onExpansionChanged) does not resolve the issue.
@eseidelGoogle , could you point us at the code @Hixie may have touched (in regardds to "keeping alive offscreen widgets") that may need fixing? Cheers!

From @rickbsgu on #11629:

You can see this with the 'Text fields' sub-app in the 'Gallery' app.  Pop up a keyboard, enter values, scroll around.  Happens on iOS and Android.  Hidden/scrolled out fields get set back to their initial value(s).
This seems to be a bug or incomplete implementation.  I would think a normal expectation would be to create the form and whatever values are entered in the fields while the form is active should remain until the form is either submitted or dismissed (or initial values explicitly restored.)  You shouldn't have to do anything out of the ordinary to preserve values through scrolling/keyboard popups or whatever else might inadvertently destroy the fields while using it (the form.)
If otherwise, the demo needs to be beefed up to show how to preserve values through scrolling/hiding/other operations while the form is active.

Creating a TextEditorController only works with TextFormFields.  A more generic solution is needed for other FormField derivations.

Ok, I've taken a couple of swings at this.  Attached are a couple of zipballs that contain the lib sources - just create a project and replace the lib sources with these (I'm not ready to put this up on gitub, yet - for one thing, I need to break it apart and each component needs lots of tests.)
The first approach (NewFormPersist.zip) involves modifying Form and support classes to forward the '_fieldDidChange' callback in FormState to a callback visible in the form widget ('onFormFieldChanged').  Not particularly elegant, but it works, it's comparatively simple, and leaves pretty much all of the handling machinery to the caller.  It is a minimal mod.
The second approach (StatePersister.zip) creates a new class (FormFieldStatePersister) which is instantiated above the form class.  ValueNotifiers (including TextEditingController) are created and
registered with the class and inserted into the FormField instances. (You could do it with separate instances of ValueNotifiers, but it gets messy.)  This doesn't change Form or TextFormField at all.
Both use a TextFormField instance and a few instances of a class I'm developing -
'RadioTileChoiceFormField', which is a FormField derivation containing a collection of RadioTiles.
When you bring up the app, you'll see a 'TextFormField' followed by a few 'RadioTileChoiceFormField's in various configurations.  Pop up the keyboard to enter text, and then put it away (it crashes if you scroll and then check a radio button that was hidden when the keyboard is up - have to figure that out.)  When the keyboard is put away, any values that were set in covered 'RadioTileChoiceFormFields' remain (what you want).  If you scroll up and scroll back down, the 'TextFormField' content remains (also what you want.)
As a bonus, a 'RESET' button resets everything back to their initial state (something a user would likely want to do, I think.)
So, neither of these approaches may be the ultimate answer or even good, but they do demonstrate approaches to address the problem (been a great learning experience for me...)
Cheers
NewFormPersist.zip
StatePersister.zip

I've posted one approach to this on the discussion board:
Flutter Form persistence + example RadioTile FormField derivation

(It would be much more convenient if the patches you wanted people to review were online e.g. on GitHub rather than in a zip file that had to be locally uncompressed, opened, etc.)

Not sure how to present this at such a nascent stage.  The demos work and I wanted to provide a heads up to people that might be struggling with this, early.   I originally put the post and files here, but subsequently decided it's not really a good place for it.  So, I posted it on the discussion board and referenced the post here.
One thing I just realized is this is open to pull requests.  I'll do one and put in the alternative approach that requires flutter mods.  Y'all can do what you want with it.
The other approach (that does not require flutter mods) is my primary focus and is pretty strawman at this stage.  I need to flesh it out, a lot.  I'm leery of putting something up at such a nascent state...
I'm open to suggestions.
Thanks,
rickb

Ok, I think I know how to approach this.  Sorry for the noise.

This is worse than I thought.  Turns out that if a field is hidden (deleted), 'onSave()' doesn't get called, either, nor does any supplied validator function.
For the 'onSave()' issue, the answer is to get values from a persister mechanism and not even supply an 'onSave()' function.
I suspect the validator issue will require a similar approach.  The question is how to forward error state when the field gets re-instantiated.
My working example repo that supplies a persister mechanism is here: https://github.com/rickbsgu/rbtile_formfield_demo.git.  Note that it pulls https://github.com/rickbsgu/form_fields.git as a dependency.

Ok, I came up with a solution to make sure a FormField validator() is called when a FormField instance is re-instantiated.  The FormField checks the owning Form autostate value (which persists across FormField drops and re-instantiations) and calls the validator directly if it's set.
Unfortunately, I can't make that work with TextFormField, so I cloned it and created a working version as TextInputFormField with the check and validation call in the builder call.
So, this solution keeps the validator with the field, rather than having to create yet another indirection by having to place it in the persister.
With all that, I finally seem to have a Form that behaves as I would expect it to.

So, thinking more on this, I would suggest what is needed is a class that encapsulates all of this - something like 'FormPage' or 'FormView'.  It would contain a form and the persisters (and perhaps a FocusNode).
If the whole thing were self-contained, it would be much easier for users to deal with.

Hi there,
I think you can simply solve this by assigning an initialValue to the TextFormField i.e., initialValue: _controller.text,
but, i am not so sure if this is of any help to you but obviously this should happen whenever a state builds the TextFormField.
Please, do let me know if you have any more suggestions or any other way to solve this issue.

How can one create TextEditingControllers  if using a map to create the form fields dynamically.

hi @vazad28 , can you please elaborate on what you are trying to achieve? As i am not sure 'using a map to create the form fields dynamically'.
Many Thanks,
Mahi

Hey, @toregua , have you got to solve the problem?
One workaround is to use the SingleChildScrollView with child as Column and include all your widgets in it then you might overcome this  '_debugUltimatePreviousSiblingOf(after, equals: _firstChild)' error as the formfields are not removed from view as they are done inside a ListView. I've had the same problem and solved by building the widget as a SingleChildScrollView.
Many thanks,
Mahi.

this is what I'm trying
List getTemplateFields() {
List _fieldWidgets = new List();
for(var idx = 0; idx < _templateFieldList.length; idx++){
  switch (_templateFieldList[idx].type) {
    case 'text':
      _fieldWidgets.add(new ListTile(
        title: new TextFormField(
          keyboardType: TextInputType.text,
          style: Theme.of(context).textTheme.subhead,
          //labelText: globals.capitalize(_templateFieldList[idx].title),
          initialValue:
              _caseData.fieldsData[_templateFieldList[idx].slug] ?? '',
          validator: (val){
            if(_autovalidate) formValidator.validateAlphaNum(val);
            _caseData.fieldsData[_templateFieldList[idx].slug] = val;
          },
          onSaved: (newVal) => setState(() => _caseData
                  .fieldsData[_templateFieldList[idx].slug] = newVal)),
      ));
      break;
    case 'number':
      _fieldWidgets.add(new KeepAlive(
          key: new Key(_templateFieldList[idx].slug),
          keepAlive: true,
          child : new TextFormField(
            keyboardType: TextInputType.number,
            style: Theme.of(context).textTheme.subhead,
            controller: hasController[idx],
            // initialValue:
            //     _caseData.fieldsData[_templateFieldList[idx].slug] ?? '',
            decoration: new InputDecoration(
                labelText: globals.capitalize(_templateFieldList[idx].title)),
            validator: (val){
              print("validate val $val");
              if(_autovalidate) formValidator.validateNumber(val);
              _caseData.fieldsData[_templateFieldList[idx].slug] = val;
            },
            onSaved: (newVal) => setState(() => _caseData
                .fieldsData[_templateFieldList[idx].slug] = newVal)),
      ));
      break;
    case 'date':
      _fieldWidgets.add( new ListTile(
        title: new TextFormField(
            keyboardType: TextInputType.datetime,
            style: Theme.of(context).textTheme.subhead,
            initialValue:
                _caseData.fieldsData[_templateFieldList[idx].slug] ?? '',
            decoration: new InputDecoration(
                labelText: globals.capitalize(_templateFieldList[idx].title)),
            validator: formValidator.validateString,
            onSaved: (newVal) => setState(() => _caseData
                .fieldsData[_templateFieldList[idx].slug] = newVal)),
      ));
      break;

.......

Hi @vazad28 , I think you can just have a list for TextEditingControllers as well just like you did for the textfields.

oh sorry just use the textfield not the textformfield then you will be fine.

With textField alone, I can's use validator. Can I?

yesyou can use validators as well its only a call back and you can do this in onChanged value
            ```
                 new TextField(
                controller: _nameController,
                focusNode: _nameFocusNode,
                keyboardType: TextInputType.text,
                autocorrect: false,
               decoration: new InputDecoration(
                labelText: 'Name *',
                 errorText: _nameFieldErrorText,
                       ),
                       onChanged: (String value) {
                              if (!mounted) return;
                        setState(() {
                           (value.length > 0)
                               ? _formWasEdited = true
                            : _formWasEdited = false;

                customerDetailsModel.setCustomerName(value.trim());

                var str = validateName(value);

                (str == null)
                    ? _nameFieldErrorText = null
                    : _nameFieldErrorText = str;
                if (widget.borrowerSnapShot.isNotEmpty) {
                  (existingCustomerName.trim() ==
                          _nameController.text.trim())
                      ? nameEdited = false
                      : nameEdited = true;
                }
              });
              if (!(_nameController.text.isEmpty)) {
                _formWasEdited = true;
              }
            },
          ),
       String validateName(String value) {
          //  bool _formWasEdited = true;
              if (value.isEmpty) return 'Name is required.';
             final RegExp nameExp = new RegExp(r'^[A-Za-z ]+$');
           if (!nameExp.hasMatch(value))
              return 'Please enter only alphabetical characters and spaces.';
           if (value.length > 25) {
           return 'Name cannot exceed 25 characters';
          }
           return null;
         }
       ```

make sure you initialize the _nameFieldErrorText  = null; and just the string from your validation to _nameFieldErrorText like i did in validateName(value).

Hmm.. let me explore. Thanks a lot for keeping the conversation up...

It works damn good with textfields, rather than textformfields, trust me its worth it.

@Mahi-K  Awesome!! Works very well. Thank you so much.

good to hear that, thank you,

@BenSower Please close the bug if you think the issue is resolved, Many Thanks.

@Mahender-Prayuta thanks for reminding me, after all I opened this ticket last August.
@Hixie, do you think I can close this? I kind of lost track what the recommended solution could be. Has there actually been any development or would you accept Mahender-Prayutas solution as a sufficient workaround?

At a minimum we need to improve the demo to not be buggy. We probably also need to add better API docs. So let's not close this yet. :-)

I just experienced this issue and was wondering if there's a workaround for the ExpansionTile widget?

hi @r3ck3z57 , could you please tell me what you are trying to achieve and what went wrong, so that we can figure out what the problem might be?

hey @Mahender-Prayuta , thank you for the quick reply! I'm pulling data from FireStore and putting it in a list. I have a listview with 4 ExpansionTile widgets. I can open the top three widgets (last one, the arrow rotates but it won't expand), and when I scroll up to the top, the 3rd ExpansionTile collapses and can't be expanded. I tested this by expanding the tiles from bottom to top (I can expand all of them but when I get to the top, the last 2 collapse and can't be expanded.

do one thing try and wrap all the expansion tiles inside a column and wrap the column inside a SingleChildScrollView, see if this helps. Thanks

https://github.com/flutter/flutter/pull/15484 addresses one problem that's come up here: TextFormFields content will disappear when scrolled.

Thanks @HansMuller  for opening the issue #15484 ,  atleast  we know there is an issue tracking the bug. In the meantime, we can use the workaround suggested to use the TextField and a custom validator in onChanged: event.

@Mahender-Prayuta sorry for the delay. I just tested it and it works perfectly. Thank you!

@r3ck3z57 glad to know it worked. Thanks.
@BenSower Ben, I think you can may be close this issue as this is now tracked in #15484. Many Thanks.

What's the latest on this issue? Is there a workaround until it's solved?
Is the PR #15484 in the beta branch yet?

@acidjazz - PR #15484 was on version 2.8 (and later) of the beta branch: https://flutter.io/sdk-archive/#linux

I've been trying to use PR #15484 as a solution to my inputs disappearing and reseting:
Above in my State class..
final List<TextEditingController> _controllers = new List.generate(25, (int n) {
    return new TextEditingController();

One of my TextFormField's:
new TextFormField(
  decoration: const InputDecoration(
    icon: const Icon(Icons.computer),
    labelText: 'FTP Host',
  ),
  validator: _validateField,
  initialValue: user.ftpHost,
  keyboardType: TextInputType.url,
  onSaved: (String value) {
    user.ftpHost = value;
  },
  controller: _controllers[0],
)

I keep getting
'package:flutter/src/material/text_form_field.dart': Failed assertion: line 72 pos 15: 'initialValue == null || controller == null': is not true.

Exception
I/flutter ( 8385): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 8385): The following assertion was thrown building Settings(dirty, state: SettingsState#47968):
I/flutter ( 8385): 'package:flutter/src/material/text_form_field.dart': Failed assertion: line 72 pos 15: 'initialValue
I/flutter ( 8385): == null || controller == null': is not true.
I/flutter ( 8385):
I/flutter ( 8385): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter ( 8385): more information in this error message to help you determine and fix the underlying cause.
I/flutter ( 8385): In either case, please report this assertion by filing a bug on GitHub:
I/flutter ( 8385):   https://github.com/flutter/flutter/issues/new
I/flutter ( 8385):
I/flutter ( 8385): When the exception was thrown, this was the stack:
I/flutter ( 8385): #2      new TextFormField (package:flutter/src/material/text_form_field.dart)
I/flutter ( 8385): #3      SettingsState.build (package:maxanet_uploader/pages/settings.dart:103:21)
I/flutter ( 8385): #4      StatefulElement.build (package:flutter/src/widgets/framework.dart:3722:27)
I/flutter ( 8385): #5      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3634:15)
I/flutter ( 8385): #6      Element.rebuild (package:flutter/src/widgets/framework.dart:3487:5)
I/flutter ( 8385): #7      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2234:33)
I/flutter ( 8385): #8      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:626:20)
I/flutter ( 8385): #9      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:208:5)
I/flutter ( 8385): #10     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
I/flutter ( 8385): #11     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
I/flutter ( 8385): #12     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:842:5)
I/flutter ( 8385): #13     _invoke (dart:ui/hooks.dart:120:13)
I/flutter ( 8385): #14     _drawFrame (dart:ui/hooks.dart:109:3)
I/flutter ( 8385): (elided 2 frames from class _AssertionError)
I/flutter ( 8385): ════════════════════════════════════════════════════════════════════════════════════════════════════

Hi Kevin,
I’ve actually described a workaround for this problem here https://github.com/flutter/flutter/issues/11500
instead of ListView use the SingleChildScrollView and use a Column as Child to include all your widgets inside the Column
just have a look at the advice given to @vazad28 and see if that helps you.
Regards,
Mahi K,
Mobile Technology Solutions Lead,
Prayuta Technologies Private Limited,
Mobile: +91-7729882000.
On 16 May 2018, 12:41 AM +0530, kevin olson<EMAIL_ADDRESS>wrote:

I've been trying to use PR #15484 as a solution to my inputs disappearing and reseting:
Above in my State class..
final List _controllers = new List.generate(25, (int n) {
return new TextEditingController();
One of my TextFormField's:
new TextFormField(
decoration: const InputDecoration(
icon: const Icon(Icons.computer),
labelText: 'FTP Host',
),
validator: _validateField,
initialValue: user.ftpHost,
keyboardType: TextInputType.url,
onSaved: (String value) {
user.ftpHost = value;
},
controller: _controllers[0],
)
I keep getting
'package:flutter/src/material/text_form_field.dart': Failed assertion: line 72 pos 15: 'initialValue == null || controller == null': is not true.
Exception
I/flutter ( 8385): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 8385): The following assertion was thrown building Settings(dirty, state: SettingsState#47968):
I/flutter ( 8385): 'package:flutter/src/material/text_form_field.dart': Failed assertion: line 72 pos 15: 'initialValue
I/flutter ( 8385): == null || controller == null': is not true.
I/flutter ( 8385):
I/flutter ( 8385): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter ( 8385): more information in this error message to help you determine and fix the underlying cause.
I/flutter ( 8385): In either case, please report this assertion by filing a bug on GitHub:
I/flutter ( 8385):   https://github.com/flutter/flutter/issues/new
I/flutter ( 8385):
I/flutter ( 8385): When the exception was thrown, this was the stack:
I/flutter ( 8385): #2      new TextFormField (package:flutter/src/material/text_form_field.dart)
I/flutter ( 8385): #3      SettingsState.build (package:maxanet_uploader/pages/settings.dart:103:21)
I/flutter ( 8385): #4      StatefulElement.build (package:flutter/src/widgets/framework.dart:3722:27)
I/flutter ( 8385): #5      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3634:15)
I/flutter ( 8385): #6      Element.rebuild (package:flutter/src/widgets/framework.dart:3487:5)
I/flutter ( 8385): #7      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2234:33)
I/flutter ( 8385): #8      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:626:20)
I/flutter ( 8385): #9      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:208:5)
I/flutter ( 8385): #10     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
I/flutter ( 8385): #11     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
I/flutter ( 8385): #12     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:842:5)
I/flutter ( 8385): #13     _invoke (dart:ui/hooks.dart:120:13)
I/flutter ( 8385): #14     _drawFrame (dart:ui/hooks.dart:109:3)
I/flutter ( 8385): (elided 2 frames from class _AssertionError)
I/flutter ( 8385): ════════════════════════════════════════════════════════════════════════════════════════════════════
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

thanks @Mahender-Prayuta that worked perfectly! Here is a sample of your solution so the next person w/ this issue can resolve it faster.
...
        body: new Form(
          key: _formKey,
          child: new Container(
            padding: new EdgeInsets.symmetric(horizontal: 30.0, vertical: 30.0),
            child: SingleChildScrollView(
              child: new Column(
                children: <Widget>[
                  new TextFormField(
                    decoration: const InputDecoration(
                      icon: const Icon(Icons.computer),
                      labelText: 'FTP Host',
                    ),
                    validator: _validateField,
                    initialValue: user.ftpHost,
                    keyboardType: TextInputType.url,
                    onSaved: (String value) {
                      user.ftpHost = value;
                    },
                  ),
                  new TextFormField(
                    decoration: const InputDecoration(
                      icon: const Icon(Icons.account_box),
                      labelText: 'FTP Username',
                    ),
                    validator: _validateField,
                    initialValue: user.ftpUsername,
                    keyboardType: TextInputType.url,
                    onSaved: (String value) {
                      user.ftpUsername = value;
                    },
                  ),
...

Yes, the original Gallery bug (per the bug's description) was fixed with #15484

@Mahender-Prayuta  I solve this problem use SingleChildScrollView ,this is easy way to solve this problem.
But with ohter Stateful widget , you have to write some code to implement the child Stateful widget can notify the parent store the changed state for the next render .

@androidvov can you show an example of how you solved this using that? I've tried it multiple times with no luck.

@Mahender-Prayuta You are awsome 😄  👍

@Mahender-Prayuta Thank you very vey very much.

Is this being fixed as I'm still having this issue on the stable channel. For now I'm using @Mahender-Prayuta solution.

I've facing this issue, solved replacing ListView to a SingleChildScrollView as suggested  by @Mahender-Prayuta

This issue is not yet fixed? It has been 3 years.....
I encountered it today, and used SingleChildScrollView to fix the problem as suggested.
But rather concerned about shipping my app with flutter now.

Adding AutomaticKeepAliveClientMixin to my component and using wantKeepAlive fixed my problem while still using ListView.
https://api.flutter.dev/flutter/widgets/AutomaticKeepAliveClientMixin-mixin.html

If you still have the problem. Or for those who are facing it recently:
You need to save your state before the list view recicle the textfields.
The onSaved method will be triggered only on form submission, so, you need to use onChanged
For instance:
      onSaved: (value) => setState(() =>_anObject.aProperty = value),       onChanged: (value) => setState(() =>_anObject.aProperty = value),


Error when parsing Edm.Time

Hi, we use the Cloud SDK for communicating with SAP SuccessFactors OData v2 services.
Describe the bug
The payload containing an Edm.Time field obtained from an OData request cannot be properly parsed.
In this case the backend responds with an object that has value PT16H in an Edm.Time typed field.
Note that this is a time only containing information about the hour; minutes and seconds are 0 and thus omitted. I'm not sure if this compliant with the OData v2 standard but that's how SuccessFactors responds.
To Reproduce

Run the script below
b. Alternatively, use the OData client for SuccessFactors entity EmployeeTime and execute a GetAll request.
See error Failed to parse the value: PT16H to time

Expected behavior
The string PT16H should be parsed to
{
  "hours": 0,
  "minutes": 0,
  "seconds": 0
}

Used Versions:

node version via node -v: v12.20.0
npm version via npm -v: 7.5.3
SAP Cloud SDK version you used as dependency: 1.50.0

Code Examples
This is a MWE for reproducing the error. I had to manually re-type this so I hope there is no JS error.
const { edmToTs } = require("@sap-cloud-sdk/core/dist/odata-v2/payload-value-converter");

const edmTime = "Edm.Time";
const value = "PT16H";

edmToTs(value, edmTime);

In my opinion the error is in this function: https://github.com/SAP/cloud-sdk-js/blob/b6c38b4bf32be1c00107942d8380ef65541432cb/packages/core/src/odata-v2/payload-value-converter.ts#L43-L53
The minute and second parts should be defined as optional in this regex.
Impact / Priority
Affected development phase: Development
Impact: Inconvenience or Impaired (as a workaround we declared the field as Edm.String in the EDMX file and manually handle conversions)
Timeline: Go-Live is in a few weeks
Thanks a lot!

Hi @lennart-m ,
Thanks for raising up.
I think you are right.
Could you please share more about the Go-Live time line (e.g., which calendar week? at the end of November?) so we can plan the fix?
Best regards,
Junjie

I also checked in the OData spec for Edm.time and in the linked docuemtation I think to leave out parts e.g. PT16H is ok.


Listing factors fails if a signed_nonce factor is encountered

The API docs specify that a signed_nonce is a valid type of factor, but the Python SDK is unable to return successfully if one is encountered and returns a KeyError('signed_nonce'):

    user_factors, user_factors_resp, user_factors_err = await okta_client.list_factors(
        user["_source"]["okta"]["id"]
    )

I have same behavior.

I experience the same

I experience the same behavior.
It seems that support for the signed_nonce factor hasn't been implemented in the Python SDK since being added to Okta - the OKTA_FACTOR_TYPE_TO_FACTOR dictionary in constants.py doesn't have the signed_nonce factor entry, and there is no corresponding model implemented under the models directory.

Yes, you can do it, but it's not proper solution if it's possible to fix openapi specs and refresh SDK to have all current types of factors covered. I am using it on 20+ servers.

Same issue here with listing signed_nonce. Hope it can be fixed soon as I would prefer to use the SDK instead of workaround.

This is still happening in the latest version - 2.9.5. OKTA_FACTOR_TYPE_TO_FACTOR is missing the SIGNED_NONCE factor type. Can you please generate a new version of the SDK with this small fix?


Bug or intentional

Current Behavior
For the treeview and recursive treeview, if you set the selection prop without multiple ie single option, this only seems to make nodes at the same level radio buttons.  It's still possible to select more than one option from different branches.  Is this a bug or the way the designers intended it to behave?

Expected Behavior
No response
Steps To Reproduce
No response
Link to Reproduction / Stackblitz
No response
More Information
No response

@eft currently the single selection records the top level and children item state independently. You can test this in the demo in your screenshot above. Monitor the medium and books selection:
https://www.skeleton.dev/components/tree-views#single
We do not take an opinionated stance on how you you prefer to use this,  however you do have the power to keep these in sync if you wish. To accomplish this use one of the events here:
https://www.skeleton.dev/components/tree-views?tab=events
Then pass the group value and use this to update the group state. The interface should adhere to this as long a bind is used.
Please note we will also be revisiting this component soon per Skeleton v3. You can see a number of community requests against this feature here:
https://github.com/skeletonlabs/skeleton/issues/2358
If you would like to request a change in this behavior, you can add comment in this thread for this.


Allow typescript and upgrade packages

Awesome.
Do you know if it has a significant negative effect on build time? I remember it was a problem a year ago when we migrated to typescript, but I'd assume CRA works much better with TS since then.

@Yshayy I didn't notice any impact


RuntimeError: element 0 of tensors.. OpenCLIP model

System Info
peft = 0.13.2
python = 3.12.7
transformers = 4.45.2
Who can help?
@sayakpaul
I am using inject_adapter_model(...) to finetune a model from OpenCLIP using LoRA layers. I am able to finetune the model by modifying Linear() layers and other supported types as expected. However, there is a model that I am currently training that has an attention module called "out_proj" that has the following layer type NonDynamicallyQuantizableLinear(Linear)  .  I may be mistaken but from my understanding of the source code for  NonDynamicallyQuantizableLinear(https://github.com/pytorch/pytorch/blob/main/torch/nn/modules/linear.py#L136), I should be able to treat it as just a typical torch.nn.Linear layer for my purposes. However, I always get the following error: "RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn". The lora layers are also added as expected.
  (transformer): Transformer(
    (resblocks): ModuleList(
      (0-11): 12 x ResidualAttentionBlock(
        (ln_1): LayerNorm((512,), eps=1e-05, elementwise_affine=True)
        (attn): MultiheadAttention(
          (out_proj): lora.Linear(
            (base_layer): NonDynamicallyQuantizableLinear(in_features=512, out_features=512, bias=True)
            (lora_dropout): ModuleDict(
              (default): Dropout(p=0.1, inplace=False)
            )
            (lora_A): ModuleDict(
              (default): Linear(in_features=512, out_features=32, bias=False)
            )
            (lora_B): ModuleDict(
              (default): Linear(in_features=32, out_features=512, bias=False)
            )
            (lora_embedding_A): ParameterDict()
            (lora_embedding_B): ParameterDict()
            (lora_magnitude_vector): ModuleDict()
          )
        )

The layers are successfully added when I add it via target_modules and also if I use register_custom_modules with the following mapping torch.nn.modules.linear.NonDynamicallyQuantizableLinear -> peft.tuners.lora.layer.Linear. However, neither case trains.  Furthermore, the model trains when I include any other layers e.g. a fully-connected one that's of type torch.nn.Linear.
target_modules =

[out_proj]  doesn't train
[fc1] trains
[out_proj, fc1] trains (I have to conclude that the attention layers aren't really being trained in this case and this config is equivalent to the one immediately above)

Any idea why this may be the case? Your help would be truly appreciated
Information

[ ] The official example scripts
[X] My own modified scripts

Tasks

[ ] An officially supported task in the examples folder
[X] My own task or dataset (give details below)

Reproduction
Train step:
def train_step(model, batch, loss_fn, device, trainer_cfg):
    images, tokenized_texts = batch
    images, tokenized_texts = images.to(device), tokenized_texts.to(device)

    # Forward pass: Get embeddings for images and texts # (bs, 512), (bs, 512), scalar
    image_features, text_features, scale_exp = model(images, tokenized_texts)

    # Compute logits as dot products between image and text features # (bs, bs)
    logits_per_image = (image_features @ text_features.T) / scale_exp
    logits_per_text = logits_per_image.T

    # Create labels (diagonal is the correct match)
    labels = torch.arange(images.shape[0], device=device)

    # Compute loss (bs,)
    loss = (loss_fn(logits_per_image, labels) +
            loss_fn(logits_per_text, labels)) / 2

    # If gradient accumulation is used, normalize the loss
    accumulation_steps = trainer_cfg.get('accumulation_steps', 1)
    if accumulation_steps > 1:
        loss = loss / accumulation_steps

    # Backward pass
    loss.backward()

    # Apply gradient clipping if necessary
    max_grad_norm = trainer_cfg.get('max_grad_norm', None)
    if max_grad_norm is not None:
        torch.nn.utils.clip_grad_norm_(model.parameters(), max_grad_norm)

    return loss.item()

Model structure near a layer of interest:
('transformer.resblocks.11.attn', <class 'torch.nn.modules.activation.MultiheadAttention'>)
('transformer.resblocks.11.attn.out_proj', <class 'torch.nn.modules.linear.NonDynamicallyQuantizableLinear'>)
('transformer.resblocks.11.ls_1', <class 'torch.nn.modules.linear.Identity'>)
Injection code:

    model_path = cfg.training.model_name
    # Load pretrained model, tokenizer, and image processor
    model, preprocess_train, preprocess_val = create_model_and_transforms(model_path)
    tokenizer = get_tokenizer(model_path)

    print("Before adapting..")
    total_params, trainable_params, trainable_percent = count_parameters(model)

   lora_config = LoraConfig(**cfg.lora_config.kwargs)

    # kwargs:
    #    target_modules: ["out_proj"]
    #    r: 32  # Rank of the LoRA low-rank matrices
    #    lora_alpha: 32  # Scaling factor for LoRA updates
    #    lora_dropout: 0.1  # Dropout for LoRA layers to avoid overfitting
    #    bias: 'none'  # Whether to use bias in LoRA layers []'none', 'all', 'lora_only']

  #

    lora_model = inject_adapter_in_model(lora_config, model)

Expected behavior
I would expect it to begin training. Here are the first few print outs of atypical run
[2024-11-05 20:01:55,364][utils.loggers][INFO] - Total Parameters: 154,406,529
[2024-11-05 20:01:55,366][utils.loggers][INFO] - Trainable Parameters: 2,887,680 (1.87%)
[2024-11-05 20:01:55,371][utils.loggers][INFO] - Patience scaled to 10 validation steps
Epoch 1/105: 0it [00:00, ?it/s]c:\Users\spet4299\Anaconda3\envs\tee_clip_env\Lib\site-packages\torch\nn\functional.py:5476: UserWarning: 1Torch was not compiled with flash attention. (Triggered internally at ..\aten\src\ATen\native\transformers\cuda\sdp_utils.cpp:263.)
  attn_output = scaled_dot_product_attention(q, k, v, attn_mask, dropout_p, is_causal)
[2024-11-05 20:01:57,719][utils.loggers][INFO] - Epoch 1 | step 1 | Train Loss = 2.7726
Epoch 1/105: 1it [00:02,  2.34s/it][2024-11-05 20:01:58,755][utils.loggers][INFO] - Epoch 1 | step 2 | Train Loss = 2.7726
Epoch 1/105: 2it [00:03,  1.57s/it][2024-11-05 20:01:59,659][utils.loggers][INFO] - Epoch 1 | step 3 | Train Loss = 2.7726

Update: I've found some discussions on a similar issue
#761 Discusses this. #1324  aims to fix this

Indeed, for MultiheadAttention, we have to jump through some hoops to make it work. Hopefully that PR can be merged soon, but there might still be some edge cases we haven't accounted for. If you can give that branch a try and report back if it worked for you, that would help us determine if the branch works correctly.

Thanks for your reply and your work on this library. Below are the results I am seeing for different inputs to the "target_modules" arg :
 main branch:
"out_proj": the Runtime Error in the original problem
len([m for m in peft_model.modules() if isinstance(m, PeftMha)])) equates to 0
"attn": ValueError: Target module MultiheadAttention(   (out_proj): NonDynamicallyQuantizableLinear(in_features=512, out_features=512, bias=True) ) is not supported. Currently, only the following modules are supported: `torch.nn.Linear`, `torch.nn.Embedding`, `torch.nn.Conv2d`, `transformers.pytorch_utils.Conv1D`.
 your branch:
"out_proj": the Runtime Error in the original problem
 len([m for m in peft_model.modules() if isinstance(m, PeftMha)])) equates to 12
"attn": Trains! (Thank you)
Q1)So I understand the consequences for my purpose, could I please clarify a few things?
Looking at my model print in the original issue, am I right in thinking that "out_proj" corresponds to the W_{o} matrix, and "attn" corresponds to W_{q,k,v,o}. If so, the above result would mean I basically have to lora all attention matrices instead of having the option to select just the query matrix (W_{q}) for example?
Q2) What's the main difference between inject_adapter_in_model(...) and get_peft_model(...)?
I just want a model that has extra lora layers added and that I can then immediately start training. Is there a perk to using either for my purpose?

To your questions:

Yes, when the module unifies all the attention layers into a single parameter, we cannot currently choose to target just query for instance. Typically, this does not decrease performance though.
inject_adapter_in_model is a low level API that adds the PEFT layers to the model but leaves the model as is otherwise. For get_peft_model, you get a PeftModel instance back that wraps the original model. This PeftModel has a bunch of convenience methods you will most likely want to use at a later point, like merging the layers. If you're sure you don't need those, you can use inject_adapter_in_model instead but I would recommend get_peft_model.

Thanks for your advice. I used "get_peft_model". Given that I have a custom training loop, what's the best way to save and load checkpoints for inference on the finetuned model and/or resuming training?
Here is a high-level overview of my code
# Load a pretrained model from openclip
model, preprocess_train, preprocess_val = create_model_and_transforms("hf-hub: ........")```

# Add Lora
peft_model = get_peft_model(model, lora_config)

# Train model
...
# Current ckpt saving code

    torch.save({
        'model_state_dict': peft_model.state_dict(),
        'optimizer_state_dict': optimizer.state_dict(),
    }, checkpoint_path)

Is there a way to load a peft model for inference etc.. using just the information I have saved above?
What other data would I be better off saving to make loading finetuned models easier in future?

Is there a way to load a peft model for inference etc.. using just the information I have saved above?

With a PEFT model, you should use model.save_pretrained(<path>). This saves only the PEFT weights, not the weights of the base models, since the latter are frozen and thus don't need to be saved. For inference, load the base model as you did for training, then call model = PeftModel.from_pretrained(base_model, <path>).

2. What other data would I be better off saving to make loading finetuned models easier in future?

Since I don't know your full training loop, I can't say for certain what you need besides the model and optimizer state. Just as an example, you may need to store the epoch or step to restore your data loader to the position it was in when training stopped. But only you can determine what is really needed.


mdl-datatable tr borders not showing FireFox

What MDL Version are you using? (please be specific, e.g. major.minor.patch)

V 1.3.0

What browser(s) is this bug affecting (including version)?

Firefox
* 51.0 64bt (windows)
* 52.0 64bit (windows)
* 45.4.0 (ESR version) (red hat)

What OS (and version) are you using?

Windows 7 Professional
Red hat Enterprise 6.8 Santiago

What are the steps to reproduce the bug? Can you create a plunker/codepen/jsfiddle which reproduces it?

https://codepen.io/anon/pen/ZeXOjg

What is the expected behavior?

The table rows should contain a border, of a darker gray than is shown.

What is the actual behavior?

No border is shown on the TR.

Any other information you believe would be useful?

I think it has something to do with firefox's way of handling border-collapse. Tried different ways people spoke of to solve it, but it costs more work than I would've hoped for.
Has anybody else had this issue? Someone know a way to solve it without rewriting parts just to support FF.

Sounds like a bug report should be filed with FF if one doesn't already exist. It seems to work in WebKit and Blink based browsers here and I can test IE/Edge later once the VMs download.
If there is a simple work-around someone is free to PR a patch to mdl-1.x to address this. But ideally, a bug report upstream so the actual bug can be addressed would be far better for everyone.


Linker error due to relocation issue in assembly files

Hello,
I would like to use SPDZ2 in my research which will be used in my master thesis at RWTH Aachen. The MASCOT extension relies on this SimpleOT protocol. Unfortunately I am not able to compile and link the code to a shared object.
I tried to compile it with make clean all. But i get many like the following errors from the linker:

/usr/bin/ld: fe25519_freeze.o: relocation R_X86_64_32S against symbol `CONST_REDMASK51' can not be used when making a shared object; recompile with -fPIC

Here is the console output.
It seems that there is some problem with the relocation, which comes from loading constant values from the data section. Maybe it has to do something with using movabs instead of mov but I am not experienced enough with assembly language to solve the problem by myself.
Can you help me, how to build this library? Thanks in advance!
Here are the versions of my used tools:

$ ld --version
GNU ld (GNU Binutils) <IP_ADDRESS>70506

$ gcc --version
gcc (GCC) 7.1.1 20170630

$ as --version
GNU assembler (GNU Binutils) <IP_ADDRESS>70506

I try to build for 64bit architecture on Arch Linux.

Hi Tikras,
I did not write this software so I'm not sure if I'll be able to help (you
may want to also contact Tung Chou, the original SimpleOT author).
I'm not sure why that error would occur, I've tested on GCC versions 4.48
and 6.2 with no problems. Did you try adding -fPIC to CFLAGS in the
makefile as the message suggests?
Also, I think the code relies on SSE instructions of Intel CPUs, so you may
want to check your machine supports those (cat /proc/cpuinfo).
Peter
On 8 August 2017 at 14:06, Tikrass<EMAIL_ADDRESS>wrote:

Hello,
I would like to use SPDZ2 https://github.com/bristolcrypto/SPDZ-2 in my
research which will be used in my master thesis at RWTH Aachen. The MASCOT
extension relies on this SimpleOT protocol. Unfortunately I am not able to
compile and link the code to a shared object.
I tried to compile it with make clean all. But i get many like the
following errors from the linker:
/usr/bin/ld: fe25519_freeze.o: relocation R_X86_64_32S against symbol
`CONST_REDMASK51' can not be used when making a shared object; recompile
with -fPIC
Here https://github.com/pascholl/SimpleOT/files/1207948/make.txt is the
console output.
It seems that there is some problem with the relocation, which comes from
loading constant values from the data section. Maybe it has to do something
with using movabs instead of mov but I am not experienced enough with
assembly language to solve the problem by myself.
Can you help me, how to build this library?
Here are the versions of my used tools:
$ ld --version
GNU ld (GNU Binutils) <IP_ADDRESS>70506
$ gcc --version
gcc (GCC) 7.1.1 20170630
$ as --version
GNU assembler (GNU Binutils) <IP_ADDRESS>70506
I try to build for 64bit architecture on Arch Linux.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/pascholl/SimpleOT/issues/2, or mute the thread
https://github.com/notifications/unsubscribe-auth/AP1PqfQi0X_FLX_EWv6-r36elIkL6U1fks5sWE89gaJpZM4Owo27
.

It looks like it is a problem with the new versions of gcc and binutils, who
I was able to compile it, using an old version of gcc (6.3).
Therefore I changed in the Makefile the first line to

CC = /usr/bin/gcc-6.3

The suggestion using the -fPIC option would not help, because it does only affect C/C++ compilation but not the linker and the assembler files, where the error occurs. However, big thanks for your help and time!
Regards,
Thibaud


UnhandledPromiseRejectionWarning: HttpError: Error saving asset

It looks like the file exists but the upload fails (and is not retried):
Run softprops/action-gh-release@v1
  with:
    files: amz-deno.gz
  deno-lambda-layer.zip
  deno-lambda-example.zip

    draft: true
  env:
    GITHUB_TOKEN: ***
⬆ Uploading amz-deno.gz...
⬆ Uploading deno-lambda-layer.zip...
⬆ Uploading deno-lambda-example.zip...
🎉 Release ready at https://github.com/hayd/deno-lambda/releases/tag/0.35.0
(node:4725) UnhandledPromiseRejectionWarning: HttpError: Error saving asset
    at /home/runner/work/_actions/softprops/action-gh-release/v1/dist/index.js:1:273881
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:4725) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4725) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This is the first time I've seen this, previously it has been working.

Same issue.
👩🏭 Creating new GitHub release for tag<PHONE_NUMBER>05...
⬆ Uploading direct-excluse-list...
⬆ Uploading direct-list...
⬆ Uploading geoip.dat...
⬆ Uploading geoip.dat.sha256sum...
⬆ Uploading geosite.dat...
⬆ Uploading geosite.dat.sha256sum...
⬆ Uploading proxy-excluse-list...
⬆ Uploading proxy-list...
⬆ Uploading reject-excluse-list...
⬆ Uploading reject-list...
🎉 Release ready at https://github.com/Loyalsoldier/v2ray-rules-dat/releases/tag/202003010505
(node:5352) UnhandledPromiseRejectionWarning: HttpError: Error saving asset
    at /home/runner/work/_actions/softprops/action-gh-release/v1/dist/index.js:1:273881
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:5352) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5352) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:5352) UnhandledPromiseRejectionWarning: HttpError: Error saving asset
    at /home/runner/work/_actions/softprops/action-gh-release/v1/dist/index.js:1:273881
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:5352) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

2 files failed while 10 of them are okay.

Duplicate #43


The load execution start time and program start gap is large - Azure Function APP

I am trying to implement Asynchronous Azure Function App using python. When I am testing the simple code with load noticing a larger time gap in execution start time and program start time. Below mention main two components are there in the code -

Connection with Postgres DB object.
One loop which is taking around 200ms time.

Let me know how to solve this problem

@Nilabrata thanks for reporting this issue. Can you share the code snippets and we will take a further look?


Medium Visual Challenge

My attempt at replicating Medium's app:

What went well

I see that the frame now has the 4 rounded corners on iOS instead of the top pointy ones, or did I do something different? 🤔
Unrelated, perhaps, but I find PlatformConfiguration's iOSSpecific and AndroidSpecific super useful!

What didn't

Margins are a bit to big in some scenarios. My ListView for example had to have a big negative top margin after the ScrollView so the spacing wasn't too big.
Is the "Silver" color not the same on both platforms? They seem a bit different. I guess this is related to @Depechie's point regarding label colors.

I would like to see

A way to easily change the selected background on Android, or is there one already? I keep doing some weird stuff on my cells Custom Renderers.
It would be great to have a bit more control over the shadows (x, y and blur)

Result:

Android
iOS

Thanks @LaloCo ! Great notes.
Frame corner issue: https://github.com/xamarin/Xamarin.Forms/issues/5544

I find PlatformConfiguration's iOSSpecific and AndroidSpecific super useful!

How did you discover them?

A way to easily change the selected background on Android, or is there one already? I keep doing some weird stuff on my cells Custom Renderers.

You'll be glad to get this: https://github.com/xamarin/Xamarin.Forms/pull/4867
More blur control on the shadows, absolutely. The next iteration is going to be exposing properties like that.

Frame corner issue: xamarin/Xamarin.Forms#5544
You'll be glad to get this: xamarin/Xamarin.Forms#4867
More blur control on the shadows, absolutely. The next iteration is going to be exposing properties like that.

 You guys rock 🎸

How did you discover them?

I think it was back when I was looking for ways to handle the new iPhone X (with its notch and all).


Different UID/GID for data/ sub-directories

Is it possible to have the directories, notably the data/ sub-directories,
owned by a different user or at least a different group than UID/GID 5000?
This would make it so much easier to backup the data without the need for sudo/root access

User 5000 is a docker user created for the mail server purpose.
The configuration relies on this UID/GID;
There's probably a room for improvement here.
Regarding backups : https://github.com/tomav/docker-mailserver/wiki/FAQ-and-Tips#what-about-backups

Then I will use UID 5000 also on the host in order to access the data.
I want to use rsync or another tool than gzipping the whole data directory each time
hence the access from the host.

Ok, thanks.


JSONPointer Support

Full support for rfc6901, for #52, #59

Implemented in dev, will be released in 0.1.2


FIX: debug symbols format dwarf v4

Why this request is not merged?

There's no reason to enable debugging by default that too a specific standard.


Blog app - Views

Requirement
implement the design from the sneak peek wireframes.
Styling is nice to have but focus on making sure everything functions first. (Note: Ignore login logic, you would be using Devise in the coming milestone)
Use methods that you have created in the Blog App - processing data in models.

Added the required changes


I found the source of this bug:
android:supportsRtl="true" in the manifest will cause it.

Thanks @NeoDigi for tracking down the cause of the bug!
I added setTextAlignment(TEXT_ALIGNMENT_CENTER); to both DayView and WeekDayView to keep text centered. I will release the update to Maven Central by the weekend.

Thank you, It works perfectly now


CASMHMS-5472 Update password change documentation.

Summary and Scope
Update to password change documentation to avoid out-of-order operation resulting in the inability to power components on and off.
Issues and Related PRs

Resolves CASMHMS-5472 for mainline
Change will also be needed in release/1.2.5, release/1.2, release/1.0, release/0.9

Pull Request Checklist

[x] Target branch correct

This needs to be rebased (or probably simpler, cherry-picked into the main branch). Also, note that it is now targeted for the main branch. This is appropriate -- just be sure to backport or cherry-pick it into all appropriate release branches.

Closed do to branching changes. Will create a new branch off of new main.


Fix an issue in HypreEuclid::SetOperator [hypre-euclid-fix]

This addresses #1308.
Reported by: @geyan3566

PR
Author
Editor
Reviewers
Assignment
Approval
Merge

#1319
@v-dobrev
@tzanio
@tzanio + @vladotomov
02/24/20
⌛due 02/25/20
⌛due 02/27/20

Merged in next for testing...


Remove unused imports

While reading the code I noticed a couple of unused imports.

Thanks, @neurosnap


able to build 0.4.0 in linux

tests passed on ubuntu linux and lon6-lambdaedgenode-a2.
Basically changed the makefile to so on linux it knows where to find jni.h
@yonromai

+1


conforming to workflow statuses in PR #228

Conforming to the Integration Workflow Designs from PR #228.

Merged #232 which seems to be almost a superset of this. So I am closing.

Sure you can close, the only part on 232 I don't like is that Type and Phase are collapsed https://github.com/redhat-ipaas/ipaas-rest/pull/232/files#diff-1c27c75d9ac87ace25896541d0377031R34
and he got rid of PENDING.


make openapi spec endpoint public - alternatesolution (HMS-1220)

This is the alternate solution over #1058
It is similar but easier to read/maintain I guess.
--
From what I learned today the openapi YAML should rather contain the security entries so also this behavior is documented but this would mean to change all middleware functions caring about authentication validation.

I do not understand, is the goal to simply expose JSON publicly? There are already three paths just like that:
	/* Used for the livenessProbe */
	s.echo.GET("/status", func(c echo.Context) error {
		return h.GetVersion(c)
	})

	/* Used for the readinessProbe */
	h.server.echo.GET("/ready", func(c echo.Context) error {
		return h.GetReadiness(c)
	})

	h.server.echo.GET("/metrics", echo.WrapHandler(promhttp.Handler()))

Why don’t you do the same thing? The JSON is available directly from the v1 package via GetSwagger() function.

The idea was to keep the same URL and "just" make it public. Wenn adding there, the URL would be different and would not be documented (in several places inheriting info from OpennAPI YAML) I guess

Obviously this last version is the simplest but also changes the URL.
@ochosi , @croissanne what are the additional actions needed if we move the URL from
/api/image-builder/v1(.0?)/openapi.json to /openapi.json

I'd also love to see "the other" (unauthenticated) endpoints documented somewhere.
Should we create (and finalize) a YAML file like this somewhere, so it can be post-processed by some docu-generation?
---
openapi: 3.0.1
info:
  version: "1.0"
  title: Image-builder API status functions
  description: Image-builder API status functions
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html

servers:
  - url: "/"

paths:
  /openapi.json:
  get:
    summary: get the openapi json specification
    operationId: getOpenapiJson
    tags:
      - meta
    responses:
      '200':
        description: returns this document
        content:
          application/json:
            schema:
              type: object

  /status:
    get:
      summary: Used for the livenessProbe
    …

  /ready:
    get:
      summary: Used for the readinessProbe
    …

  /metrics:
    get:
      summary:  Return some metrics
    …

Obviously this last version is the simplest but also changes the URL. @ochosi , @croissanne what are the additional actions needed if we move the URL from /api/image-builder/v1(.0)?/openapi.json to /openapi.json

The spec does describe v1 specifically though, and if we were to add a v2 we'd be a little stuck. If we end up having to register all routes ourselves under v1/ I think that's fine.

Fixed with #1067


Use ngx-mask

I would like to use
https://github.com/JsDaddy/ngx-mask
import { NgxMaskModule } from 'ngx-mask';
to mask my input field. Is there another way to mask the input ?

I have no idea

Is there a way to mask the input ?

Never tried. But I recommend to use moment js adapter (see readme)

How can I use moment to mask the input fields ? Can you show me ?

No. Try it on youself


implement ngapp2 rollback history and prompt for rollback reason. It …

…stores the rollback info to S3 and display it back to the history page.

r+

Cloud you please add boto>=2.39.0 requirement in setup.py? Thanks

sorry about that. asked baogang to fix it. Thanks!


changes in webhook action and readme

Help to easier find discovery parameter typos
during the implementation of the action
if (data.results == undefined ) {
return { "discovery response error" : data };

}

@moficodes Please take a look at the PR suggested by @thomassuedbroecker - Sounds like a great idea.  If you agree, let's merge it.
@thomassuedbroecker - Thanks!