Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 14 11:21
    damirrrk closed #532
  • Apr 14 11:21
    damirrrk closed #532
  • Apr 13 07:59
    Kevin-Lee commented #586
  • Apr 13 07:59
    Kevin-Lee commented #586
  • Apr 11 19:23
    eed3si9n closed #586
  • Apr 11 19:23
    eed3si9n closed #586
  • Apr 11 19:23
    eed3si9n commented #586
  • Apr 11 19:23
    eed3si9n commented #586
  • Apr 06 13:46
    Kevin-Lee opened #586
  • Apr 06 13:46
    Kevin-Lee opened #586
  • Apr 04 10:14
    borissmidt closed #398
  • Apr 04 10:14
    borissmidt closed #398
  • Mar 20 01:35
    eed3si9n closed #585
  • Mar 20 01:35
    eed3si9n closed #585
  • Mar 20 01:35
    eed3si9n commented #585
  • Mar 20 01:35
    eed3si9n commented #585
  • Mar 19 16:48
    molotch opened #585
  • Mar 19 16:48
    molotch opened #585
  • Feb 22 15:11
    bodduv opened #584
  • Feb 22 15:11
    bodduv opened #584
eugene yokota
@eed3si9n
so instead of dynamically composing, it's doing static monkey patching against Lens[A, Items]
the lack of completeness in Lens generation was mostly out of laziness. I implemented the PR in a few hours in the morning mostly by resurrecting an old PR
I figured I can get something minimal out, and if it's useful ppl can build on top of it
you're welcolme to take a look at eed3si9n/scalaxb#535 and send a PRs to improve it
Deenar Toraskar
@deenar
Thanks, I am quite new to this, still trying to find my way around Lenses and scalaxb, but will give it a go.
Deenar Toraskar
@deenar
another question for now, how do you(or can you) traverse a nested schema when there is an Optional field
Deenar Toraskar
@deenar
``` case class Bank(BICFI: Option[String] = None,

Name: Option[String] = None,
PstlAdr: Option[common.PostalAddress] = None)

case class PostalAddress(AdrTp: Option[AddressType2Code] = None,
StrtNm: Option[String] = None,
BldgNb: Option[String] = None,
PstCd: Option[String] = None,
TwnNm: Option[String] = None)

``` 

I can get Bank.PstlAdr, but go no further not sure if I can compose a Lens[Bank,Option[PostalAddress] and a Lens[PostalAddress, Option[AddressType2Code] together

Deenar Toraskar
@deenar
I figured you need a import monocle.std.option._; composePrism(some) to go from Option[A] to A
ouakrim
@Ouakrim
Hello
I am using the sbt scalaxb plugin to consume a web service in SOAP, and I ask if there is a configuration of this plugin to get the wsdl from a remote server ?
i try this but it doesn't work :
scalaxbPackageNames in (Compile, scalaxb) := Map(uri("http://172.17.0.2:8080/castlemock/mock/soap/project/UKt4ew/BookServiceSOAP") -> "com.books")
Deenar Toraskar
@deenar
Hi @eed3si9n I have a very large xsd document. scalaxb generates the source fine, but javac is running out of memory. What options do I have? I see there is a scalaxbContentsSizeLimit. I did a repo search but could find reference to its use.
Deenar Toraskar
@deenar
Hi @eed3si9n I saw an item in the backlog about JSON support. What were you thought about implementing this? I would like to take a stab at doing this?
eugene yokota
@eed3si9n
@deenar I don't think there's much you can do about the size in the current design. it would be good to be able to split the code per schema. for JSON support I use Contraband - https://www.scala-sbt.org/contraband/
Deenar Toraskar
@deenar
thanks, @eed3si9n just to clarify if one wanted to add JSON support to scalaxb, you would look at using Contraband, can you give me some pointers as to where to start? Currently scalaxb isnt using contraband to generate the case classes?
Arsene
@Tochemey
Hello folks. Please I would like to know how best I can use this tool to build soap service. I have gone through the doc but it seems it can only help consume soap service. Forgive me if I am wrong
eugene yokota
@eed3si9n
@Tochemey we haven't implemented the service portion sorry
Arsene
@Tochemey
@eed3si9n Thanks
Deenar Toraskar
@deenar
@eed3si9n I have an application that processes 100s of various incoming message types each of which have their own schema. The schema details are in the header. Is there a way other than using a large case statement to do something like
``` val doc = scalaxb.fromXML[Class.forName("pacs_001_001_02.Document")](xml)    ``` 
eugene yokota
@eed3si9n
@deenar I'm not sure if that would work. the point of typeclass-based databinding is that we know the shape of the document at compile-time. I guess you could generate custom code in the build?
Deenar Toraskar
@deenar
I know the above wouldn't work, code generation is a good idea
Deenar Toraskar
@deenar
@eed3si9n I have submitted a PR to improve Lenses generation, I cannot find where the documentation should be checked in https://scalaxb.org/scalaxb-1.8.0. The notes in the repo seem to go to release 1.5.2
eugene yokota
@eed3si9n
I started using GitHub releases. you can put whatever info on the PR itself I guess
Deenar Toraskar
@deenar
Thanks
Deenar Toraskar
@deenar
All, here is my attempt at enhancing the Lenses generation in scalaxb, comments are welcome. Currently Lens'es are generated for all members of the ADT https://scalaxb.org/scalaxb-1.8.0 . This works fine unless you have Option, List or Map elements. I have changed it such that there is a combination of Lens, Optional optics generated along with index and at functions for Lists and Maps. https://gist.github.com/deenar/642e29a3380565799634d9382dd10771
Deenar Toraskar
@deenar

What am I doing wrong? I have a couple of properties set in built.sbt, they dont seem to have any effect

scalaxbPrependFamily := true
scalaxbNamedAttributes := true

I am also getting the following warnings, other scalaxb properties like scalaxbProtocolPackageName seem to work fine.

[warn] there are 2 keys that are not used by any other settings/tasks:
[warn]  
[warn] * root / scalaxbNamedAttributes
[warn]   +- /Users/deenar/dev/isotoolkit/build.sbt:94
[warn] * root / scalaxbPrependFamily
[warn]   +- /Users/deenar/dev/isotoolkit/build.sbt:99
[warn]
João Ferreira
@jtjeferreira
I think you need to set them on submodules
Deenar Toraskar
@deenar
Thanks @jtjeferreira
Milad Khajavi
@khajavi
Is there any reason that XsTypeSymbol is not defined as sealed trait? All of them are in one compilation unit and if it defined as a sealed trait, we have the benefit of compilation check on patter machings.
@eed3si9n
Milad Khajavi
@khajavi
also BuiltInSimpleTypeSymbol
eugene yokota
@eed3si9n
@khajavi I think it should be. I'm guessing it's not because at some point I was trying to dogfood scalaxb by letting scalaxb generate binding for XML Schema.
Álvaro Castellanos López
@AlvaroCaste

hi! I've seen that on XMLProtocol, targetNamespace is generated as a None defaultScope. In my case, this hampers that a request has been well built.
Let's me explain this with an example. Having this wsdl:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions 
    xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
    xmlns:tns="http://myservice.com/service/login" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:s="http://www.w3.org/2001/XMLSchema"
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
    targetNamespace="http://myservice.com/service/login"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://myservice.com/service/login">
      <s:element name="getAuth">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="user" type="s:string" />
            <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="password" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      .
      .
      .

what I get as a request for getAuth is:

<soap11:Envelope 
xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:tns="http://myservice.com/service/login"
xmlns="http://myservice.com/service/login">
    <soap11:Body>
        <getAuth>
            <user>user</user>
            <password>password</password>
        </getAuth>
    </soap11:Body>
</soap11:Envelope>

and because <getAuth> doesn't have tns we get:

System.Web.Services.Protocols.SoapException: The element 'getAuth' in namespace 'http://myservice.com/service/login' has invalid child element 'user' in namespace 'http://myservice.com/service/login'. List of possible elements expected: 'user'.

I've realized that removing None -> "http://myservice.com/service/login" from defaultScope

trait XMLProtocol extends scalaxb.XMLStandardTypes {
  val defaultScope = scalaxb.toScope(None -> "http://myservice.com/service/login",
    Some("tns") -> "http://myservice.com/service/login",
    Some("xs") -> "http://www.w3.org/2001/XMLSchema",
    Some("xsi") -> "http://www.w3.org/2001/XMLSchema-instance")
...

this is solved and the request is well built:

<soap11:Envelope 
xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://myservice.com/service/login">
    <soap11:Body>
        <tns:getAuth>
            <user>user</user>
            <password>password</password>
        </tns:getAuth>
    </soap11:Body>
</soap11:Envelope>

So, my question is, how can I fix this?

We use sbt-scalaxb 1.8.0, scala 2.13.4 and this is part of my build.sbt

  lazy val scalaXml           = "org.scala-lang.modules"       %% "scala-xml"                % "2.0.0-M2"
  lazy val scalaParser        = "org.scala-lang.modules"       %% "scala-parser-combinators" % "1.1.2"
  lazy val dispatch           = "org.dispatchhttp"             %% "dispatch-core"            % "1.1.3"

...

    .enablePlugins(ScalaxbPlugin)
    .settings(
      scalacOptions ++= Seq("-Wconf:src=src_managed/.*:silent"),
      sourceGenerators in Compile += (scalaxb in Compile).taskValue,
      scalaxbPackageName in (Compile, scalaxb) := "generated",
      scalaxbDispatchVersion in (Compile, scalaxb) := "1.1.3"
    )

Please, let me know if I need to report something else to clarify this. I hope someone can help me. Thanks :)

Jarod Belshaw
@jarod7736
I have <xs:element name="partition" minOccurs="0" maxOccurs="1" type="test_partition_type"> <xs:annotation> <xs:appinfo> <jaxb:property> <jaxb:baseType> <jaxb:javaType name="TestPartitionType" parseMethod="TestPartitionTypeAdapter.decode" printMethod="TestPartitionTypeAdapter.encode" /> </jaxb:baseType> </jaxb:property> </xs:appinfo> </xs:annotation> </xs:element>
<xs:element name="partition" minOccurs="0" maxOccurs="1" type="test_partition_type">
                            <xs:annotation>
                                <xs:appinfo>
                                    <jaxb:property>
                                        <jaxb:baseType>
                                            <jaxb:javaType name="TestPartitionType" parseMethod="TestPartitionTypeAdapter.decode"
                                                printMethod="TestPartitionTypeAdapter.encode" />
                                        </jaxb:baseType>
                                    </jaxb:property>
                                </xs:appinfo>
                            </xs:annotation>
                        </xs:element>
in my xsd... is there a way to generate that javaType with scalaxb? I'm not certain how i'd reference it. thoughts?
Milad Khajavi
@khajavi
@eed3si9n
I've two xsd files in my project located in src/main/xsd directory.
Is there any way, to instruct the scalaxb-sbt to create separate xmlrotocol for each of my xsd files?
eugene yokota
@eed3si9n
@khajavi it's possible, but it's kind of complicated. you'd probably be better off making a mini subproject in sbt for each.
if you're interested (in the complicated approach that I no longer recommend) I documented it in 2012 - https://scalaxb.org/multiple-configs
Chad Selph
@chadselph
@eed3si9n i wonder if you have thoughts about this issue, eed3si9n/scalaxb#551 given it seems coursier is being pushed as the distribution tool of choice going forward
Stanislav Kovalenko
@PepRoll
@eed3si9n could you make a new release? this commit eed3si9n/scalaxb@06564ec will help me to up scala version in my project, thx
eugene yokota
@eed3si9n
@PepRoll I created an issue for it here - eed3si9n/scalaxb#567
Shashi Kumar
@shashiboddu:matrix.org
[m]
Hello Can some one provide me the sample maven scalaxb project which works for wsdl files.
Viktor Hedefalk
@hedefalk
Quick question before I troubleshoot - I have an old 2.10 project, how far can I go with scalaxb - should 1.8.1 support 2.10?
Gwenael Cholet
@gwenaelcholet
Hi all. I am new to scalasb. I am trying to set a project with scala 2.13.6 and scalasb trying to generate at build the file from an xsd
After having set up the sbt which sbt command I am suppose to run ?
João Ferreira
@jtjeferreira
@gwenaelcholet compile
DanMaly
@DanMaly
@eed3si9n I am talking to a service that, contrary to the XML spec, requires attributes that have default values in the XSD to be present in the XML. In scalaxb, attributes with values equal to their defaults are omitted and there is no way to configure this behaviour. I could implement a new parameter to control this but I'm wondering if you agree it's worth having in the library? There are other workarounds I can use but this is the least painful.
Sean Kwak
@cosmir17

Hi :) Thank you for scalaxb, a super amazing library.

My team uses ScalaXb and we have a question. We have an element A with 4 levels of nested elements. A has B which has C which has D. Recently our schema changed from v1 to v2 and our leaf element D now has a required field D.9. We know that for data previously serialized with v1, we can provide a default value for D.9

Can we ask how we can inject the value to the D.9 field, please?